[SciPy-user] random numbers in scipy

Giovanni Samaey Giovanni.Samaey@cs.kuleuven...
Tue Apr 24 02:27:50 CDT 2007

Dear Robert,

thanks for the answer !
> The preferred way is to make your own instance of RandomState and call methods
> off of it. You should only use numpy.random.seed() if you need to work around
> other code which uses the global instance (which, unfortunately, is much of
> scipy.stats).
So I should do:

rand =  numpy.RandomState(seed)

I am willing to document this somewhere:
- I was unable to deduce this from the module's docstring (it doesn't 
have one)
- I didn't find this on the web nor in the book (I am not saying it 
isn't there somewhere -- I only looked for an hour. Maybe it is there on 
a non-obvious place).

I think the book or the docstring of the module are the best places. 

As a side remark: I find it confusing to have a numpy.random and a 
scipy.stats module (in which stats does not allow to set seeds).  Do 
both use the Mersenne Twister?  Furhtermore, you can ask random numbers 
both directly from the numpy.random module, and from a RandomState object. 


More information about the SciPy-user mailing list