3 ms·
Choosing a number with a MT is not faster than adding two numbers (which can typically be done in a single cycle).
by aidenn0 15y ago
Choosing a number with a MT is not faster than adding two numbers (which can typically be done in a single cycle).
- Natsu 15y agoThey were probably generating tons of them at once so the only operation was grabbing a number out of memory. But you're right that it takes a whole lot of operations to generate the numbers in the first place.
- bevan 15y agoYeah that might have been an exaggeration. But as I recall, once you have the MT seeded and fired up, getting a new number requires little more than a bit shift. Anyway it was substantially faster than simple alternatives I tried (including other PRNGs). One early theory I had was that using a faster PRNG than MT could lead to a better result even if it wasn't as evenly distributed. I think MT proved to be the best solution though.