[Numpy-discussion] random number generation in python compared to gsl

Matthieu Brucher matthieu.brucher@gmail....
Wed Nov 5 08:19:09 CST 2008

> Not in this case: I always get the same sequence with seed=0
> (different for both implementation, but the same each time I run it.)
> I got around it by installing pygsl and taking random numbers from
> there instead of from numpy.
> But I still find it strange to get two different sequences from two
> implementation that claim to be the same algorithm...
> Giovanni


I didn't check which MT was used, because there are several different.
MT is based on one Mersenne prime, but for instance the Boost library
wraps two generators with two different values. Perhaps the same
occurs here.
Other explanations include:
- MT must use an array of starting values, perhaps the first is 0, but
one is 0, 1, 2, 3, ... and the other uses 0, 0, 0, ...
- MT generates integers, perhaps there is a difference between the
size of the generated integers (not likely) or a difference in the
transformation into a float ?

Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/matthieubrucher

More information about the Numpy-discussion mailing list