[Numpy-discussion] Random number generators.

Charles R Harris charlesr.harris at gmail.com
Sun Jun 4 13:36:17 CDT 2006

Hi All,

But mostly Robert. I've been fooling around timing random number generators
and noticed that on an Athlon64 with 64bit binaries that the MWC8222 rng is
about 2.5x as fast as the MT19937 generator. On my machine (1.8 GHz) I get


long          2.58e+08
float         1.20e+08
double        1.34e+08
full double   1.02e+08


long          9.07e+07
float         6.33e+07
double        6.71e+07
full double   3.81e+07

numbers/sec, where the time includes accumulating the sums. This also
impacts the generation of normally distributed numbers


nums/sec:  1.12e+08
average :  1.91e-05
sigma   :  1.00e-00


nums/sec:  5.41e+07
average : -9.73e-05
sigma   :  1.00e+00

The times for 32 bit binaries is roughly the same. For generating large
arrays of random numbers on 64 bit architectures it looks like MWC8222 is a
winner. So, the question is, is there a good way to make the rng selectable?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060604/2220ba13/attachment.html 

More information about the Numpy-discussion mailing list