[Numpy-discussion] random number generation in python compared to gsl
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...
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
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.
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
More information about the Numpy-discussion