[Python-ideas] Python's Source of Randomness and the random.py module Redux
Chris Angelico
rosuav at gmail.com
Fri Sep 11 06:54:30 CEST 2015
On Fri, Sep 11, 2015 at 2:44 PM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> I suppose it would be too magic to have the seed method substitute the
> traditional PRNG for the default, while an implicitly seeded RNG
> defaults to a crypto strong algorithm?
Ooh. Actually, I rather like that idea. If you don't seed the RNG, its
output will be unpredictable; it doesn't matter whether it's a PRNG
seeded by an unknown number, a PRNG seeded by /dev/urandom, a CSRNG,
or just reading from /dev/urandom every time. Until you explicitly
request determinism, you don't have it. If Python changes its RNG
algorithm and you haven't been seeding it, would you even know? Could
it ever matter to you?
It would require a bit of an internals change; is it possible that
code depends on random.seed and random.randint are bound methods of
the same object? To implement what you describe, they'd probably have
to not be.
ChrisA
More information about the Python-ideas
mailing list