[Numpy-discussion] Is there anyway to seed random numbers without global state?

Gael Varoquaux gael.varoquaux@normalesup....
Mon Jan 12 13:52:01 CST 2009


On Mon, Jan 12, 2009 at 01:41:24PM -0600, Tom Denniston wrote:
> I would think the ideal would be to be able to build random number
> objects where each has a seed so that each object's seed is
> independent.

You mean something like:

In [1]: import numpy as np

In [2]: rs = np.random.RandomState(seed=3)
 
In [3]: rs.rand()
Out[3]: 0.12671989922202853

:)

Gaël


More information about the Numpy-discussion mailing list