<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-09-11 6:54 GMT+02:00 Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Sep 11, 2015 at 2:44 PM, Stephen J. Turnbull <<a href="mailto:stephen@xemacs.org">stephen@xemacs.org</a>> wrote:<br>
> I suppose it would be too magic to have the seed method substitute the<br>
> traditional PRNG for the default, while an implicitly seeded RNG<br>
> defaults to a crypto strong algorithm?<br>
<br>
</span>Ooh. Actually, I rather like that idea. If you don't seed the RNG, its<br>
output will be unpredictable; it doesn't matter whether it's a PRNG<br>
seeded by an unknown number, a PRNG seeded by /dev/urandom, a CSRNG,<br>
or just reading from /dev/urandom every time. Until you explicitly<br>
request determinism, you don't have it. If Python changes its RNG<br>
algorithm and you haven't been seeding it, would you even know? Could<br>
it ever matter to you?<br>
<br>
It would require a bit of an internals change; is it possible that<br>
code depends on random.seed and random.randint are bound methods of<br>
the same object? To implement what you describe, they'd probably have<br>
to not be.<br>
<br>
ChrisA<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div><br></div><div class="gmail_extra">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. <br></div><div class="gmail_extra"><br></div></div>