[SciPy-dev] random seed in scipy.stats
Sun Apr 20 02:44:29 CDT 2008
> My preference is for a pattern like this:
> def somefunc(x,y,z, prng=numpy.random):
> w = prng.standard_normal()
> This allows the default uses to share the same generator state which
> could avoid some problematic cases.
This makes sense; I agree. I also like the option of passing a
straight random seed as an option. I will at least include your
suggestion, and both if it isn't too hard and no one objects.
Since scipy.stats works with objects, it seems there are three options:
1. pass prng to the constructor; then all of the members use it.
2. pass prng individually to each rvs() function.
3. both 1 & 2
I can see arguments for both, so 3 might be the best option.
> But yes, such a change would be very welcome. It might be a
> substantial chunk of work, though, which is why I haven't done it.
Maybe, but unless I'm missing something it looks fairly
straightforward. It imports numpy.random as mtrand, nice and unique,
so it looks like it will be a lot of search and replace. Like I said,
it would be quite useful for me, so I'll see what I can do.
UBC Department of Computer Science
More information about the Scipy-dev