<div dir="ltr"><div class="gmail_quote">On Fri, Oct 3, 2008 at 12:44 AM, Tim Peters <span dir="ltr"><<a href="mailto:tim.peters@gmail.com">tim.peters@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
[Alec Henriksen]<br>
<div class="Ih2E3d">> How trustworthy is the "randomness" generated by the random module?<br>
<br>
</div>Python uses the Mersenne Twister algorithm for generating<br>
pseudo-random numbers, and that's one of the highest-quality methods<br>
known. </blockquote><div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>Hooray for Random!</div><div>-Wayne</div></div></div>