[Numpy-discussion] How do I seed the radom number generator?

Robert Kern robert.kern at gmail.com
Sat Jun 24 16:56:05 EDT 2006


Keith Goodman wrote:

> Using the same seed sometimes gives different results:
> 
> from numpy import random
> def rtest():
>   rs = random.RandomState([11,21,699,1])
>   a = rs.rand(100,1)
>   b = rs.randn(100,1)
>   return sum(a + b)
> 
>>> mytest.rtest()
> array([ 41.11776129])
> 
>>> mytest.rtest()
> array([ 40.16631018])

Fixed in SVN. Thank you.

http://projects.scipy.org/scipy/numpy/ticket/155

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco





More information about the NumPy-Discussion mailing list