[issue21470] Better seeding for the random module

Raymond Hettinger report at bugs.python.org
Sun May 11 13:02:25 CEST 2014


Raymond Hettinger added the comment:

Several thoughts:

* We're not reading urandom "a huge number of times per second".  This is just one read of 2,500 bytes.  What Ted is talking about and what we're doing are as different as night and day.

* We're also not doing this in a loop.  It is just once when Random() is initialized.  There are no threading issues here.

* 32 bytes is good but it is not enough.  There is a reason that the state space for the Mersenne Twister is so large to begin with.  Functions as simple as shuffle() eat through the possibilities very quickly.

* The "doctor, it hurts" quote is funny, but we don't have any hurt here.  Running "import os; os.urandom(2500)" takes under a millisecond on my system.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21470>
_______________________________________


More information about the Python-bugs-list mailing list