[Python-ideas] Python's Source of Randomness and the random.py module Redux
Xavier Combelle
xavier.combelle at gmail.com
Fri Sep 11 08:34:43 CEST 2015
2015-09-11 6:54 GMT+02:00 Chris Angelico <rosuav at gmail.com>:
> 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
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
I have thought of this idea and was quite seduced by it. However in this
case on a non seeded generator, getstate/setstate would be meaningless. I
also wonder what pickling generators does.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150911/a741e144/attachment-0001.html>
More information about the Python-ideas
mailing list