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

Tom Denniston tom.denniston at alum.dartmouth.org
Mon Jan 12 14:41:24 EST 2009


I know how to seed and generate random numbers using:
numpy.random.seed and numpy.random.rand

The problem is the seeding of the random numbers is global which I
would think would make it non-thread safe as well as having all the
other annoyances of global state like having so set the seed and set
it back when done.

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.  Does such a thing exist in numpy or scipy.  Does this
even make sense to people?  Is there something about random number
generation that makes it inherently a global thing?

--Tom



More information about the NumPy-Discussion mailing list