crflynn / stochastic

Generate realizations of stochastic processes in python.
http://stochastic.readthedocs.io/en/stable/
MIT License
451 stars 80 forks source link

Support RNG seeding #24

Closed anntzer closed 3 years ago

anntzer commented 4 years ago

It would be nice if the RNG used could be seeded (e.g. for reproducibility). Even better would be if users could just pass a RNG instance e.g. to the class constructor.

I can probably contribute such a feature (e.g. adding a rng kwarg to all classes), but before doing so, I would like to know 1) whether you agree at least with the basic idea and 2) whether you would be willing to drop support for numpy<1.17, as numpy1.17 introduced a new RNG API (https://numpy.org/doc/1.18/reference/random/index.html) which also has better performance (in particular using Ziggurat instead of Box-Muller for normal variates) -- it should not be too difficult to have a branch in the code to support the older API too, but I just want to know whether I can skip that work ;-)

crflynn commented 4 years ago

This would be a great feature to have. Let me know if you plan on implementing it. I've already bumped numpy to 1.17 in a recent PR.

anntzer commented 4 years ago

I moved on to using my own implementation (basically my own version of #27, +seeding) for now, so I don't plan to visit this in the short term. If no one touches it I may revisit it later but no guarantees.