[Numpy-discussion] random enhancement

Neal Becker ndbecker2@gmail....
Wed Feb 6 07:10:28 CST 2008


One thing missing from random is a mechanism to share a single underlying
rng with other code that is not part of numpy.random.

For example, I have code that generates distributions that expect a mersenne
twister (the shared, underlying rng) to be passed in as a constructor
argument.

numpy.random shares a single rng amongst it's own distributions, but I don't
see any way to share with others.

Ideally, I believe this is the preferred design:

rng1 = mersenne_twister (seed = 0)

poisson (rng1, lambda=4)
uniform (rng1, min=0, max=4)

It would be best if numpy.random adopted this approach.  Since I understand
that's not likely, the alternative is for numpy.random to add some API that
would allow direct access to the shared rng object.  



More information about the Numpy-discussion mailing list