| |
|
||||||
Searching for random number generators I found the Mersenne Twister algorithm descibed at http://www.math.keio.ac.jp/~matumoto/emt.html.
I started using the implementation I found at http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html by Richard Wagner. I liked this implementation because it was written in C++ and seemed fairly complete and fast.
I got curious about the applicability of the MMX instruction set as the algorithm seemed very suited to fine grained parallelism. I wrote this version which is almost exactly twice as fast as the original C++ code.
Enjoy,PS: On my 800Mhz Pentium III, I saw these results (generating 60M integers).
| algorithm | seconds | MTRand (0.2) | 2.16 | MTRand (0.3) | 1.88 | MMXRand | 1.06 |
|---|