[Numpy-discussion] Proposal: numpy.random.random_seed

Robert Kern robert.kern at gmail.com
Tue May 17 09:48:45 EDT 2016


On Tue, May 17, 2016 at 2:40 PM, Sturla Molden <sturla.molden at gmail.com>
wrote:
>
> Stephan Hoyer <shoyer at gmail.com> wrote:
> > I have recently encountered several use cases for randomly generate
random
> > number seeds:
> >
> > 1. When writing a library of stochastic functions that take a seed as an
> > input argument, and some of these functions call multiple other such
> > stochastic functions. Dask is one such example [1].
> >
> > 2. When a library needs to produce results that are reproducible after
> > calling numpy.random.seed, but that do not want to use the functions in
> > numpy.random directly. This came up recently in a pandas pull request
[2],
> > because we want to allow using RandomState objects as an alternative to
> > global state in numpy.random. A major advantage of this approach is
that it
> > provides an obvious alternative to reusing the private
numpy.random._mtrand
> > [3].
>
> What about making numpy.random a finite state machine, and keeping a stack
> of RandomState seeds? That is, something similar to what OpenGL does for
> its matrices? Then we get two functions, numpy.random.push_seed and
> numpy.random.pop_seed.

I don't think that addresses the issues brought up here. It's just more
global state to worry about.

--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160517/82067830/attachment.html>


More information about the NumPy-Discussion mailing list