[Tutor] How trustworthy are pseudo-random numbers?

W W srilyk at gmail.com
Fri Oct 3 12:40:46 CEST 2008


On Fri, Oct 3, 2008 at 12:44 AM, Tim Peters <tim.peters at gmail.com> wrote:

> [Alec Henriksen]
> > How trustworthy is the "randomness" generated by the random module?
>
> Python uses the Mersenne Twister algorithm for generating
> pseudo-random numbers, and that's one of the highest-quality methods
> known.


I've talked with some people about random number generation, and how you can
tell if it's random. For 10 numbers, is 5 5 5 5 5 5 5 5 5 5 random? You
really don't know, because it's random! It probably is. Even if the set
before and after are all the same, it still could be - that's the beauty of
randomness, is sometimes you can get what looks like patterns.

Of course, if you're working with data encryption, this is simply not a very
reliable way to do things. One of the most "random" ways (of course if you
were able to /exactly/ duplicate the circumstances, you'd still get the same
result. However it's much more difficult to duplicate the circumstances with
this method.) I've seen to generate a number is getting sound input from the
mic jack when there's no mic attached, and treating it like string data,
then using that as your key.

Hooray for Random!
-Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081003/43939c51/attachment.htm>


More information about the Tutor mailing list