[Python-ideas] Python's Source of Randomness and the random.py module Redux

Nick Coghlan ncoghlan at gmail.com
Fri Sep 11 04:48:07 CEST 2015

On 11 September 2015 at 08:54, Andrew Barnert via Python-ideas
<python-ideas at python.org> wrote:
> Actually, I just thought of an even simpler solution:
> Add a deterministic_singleton member to random (which is just initialized to DeterministicRandom() at startup). Now, the user fix is just to change "import random" to "from random import deterministic_singleton as random".

Change the spelling to "import random.seeded_random as random" and the
user fix is even shorter.

I do agree with the idea of continuing to provide a process global
instance of the current PRNG for ease of migration - changing a single
import is a good way to be able to address a deprecation, and looking
for the use of seeded_random in a security sensitive context would
still be fairly straightforward.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list