[Python-ideas] Globally configurable random number generation
storchaka at gmail.com
Mon Sep 14 17:04:35 CEST 2015
On 14.09.15 16:32, Nick Coghlan wrote:
> * make random.Random a subclass of SeedableRandom that deprecates
> seed(), getstate() and setstate()
I would make seed() and setstate() to switch to seedable algorithm. If
you don't use seed() or setstate(), it is not important that the
algorithm is changed. If you use seed() or setstate(), you expect
> * random.Random becomes an alias for random.SeedlessRandom
This breaks compatibility with the data pickled in older Python.
> In 3.7, "random.set_default_instance(random.seedable_random)" will opt
> back in to the deterministic PRNG when using the module level
> functions process wide, while "from random import seedable_random as
> random" will do so on a module by module basis.
What to do with "from random import random" deep in third-party module?
It caches random.random in the module dictionary.
More information about the Python-ideas