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

Giovanni Samaey giovanni.samaey@cs.kuleuven...
Wed Nov 5 04:30:43 CST 2008


Hi all,

I have a question concerning the Mersenne Twister random number  
generation in numpy:  when I seed it with 0, I get a different  
sequence of numbers in numpy, compared to GSL.

In numpy:

r = numpy.Random.RandomState(seed=0)
r.uniform(size=5)  ---->  array([ 0.5488135 ,  0.71518937,   
0.60276338,  0.54488318,  0.4236548 ])

whereas in GSL the first numbers are
0.99974    0.16291   0.2826    0.94720    0.23166

Matlab gives the same result as numpy...

I have translated some python code to c, and would like to debug it --  
therefore, I would like to have exactly the same set of random  
numbers...  How can I provoke this ?

Best.

Giovanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081105/26a8aabd/attachment.html 


More information about the Numpy-discussion mailing list