<div dir="ltr"><div class="gmail_quote">On Fri, Oct 3, 2008 at 12:44 AM, Tim Peters <span dir="ltr">&lt;<a href="mailto:tim.peters@gmail.com">tim.peters@gmail.com</a>&gt;</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">&gt; How trustworthy is the &quot;randomness&quot; generated by the random module?<br>
<br>
</div>Python uses the Mersenne Twister algorithm for generating<br>
pseudo-random numbers, and that&#39;s one of the highest-quality methods<br>
known. &nbsp;</blockquote><div><br></div><div>I&#39;ve talked with some people about random number generation, and how you can tell if it&#39;s random. For 10 numbers, is 5 5 5 5 5 5 5 5 5 5 random? You really don&#39;t know, because it&#39;s random! It probably is. Even if the set before and after are all the same, it still could be - that&#39;s the beauty of randomness, is sometimes you can get what looks like patterns.</div>
<div><br></div><div>Of course, if you&#39;re working with data encryption, this is simply not a very reliable way to do things. One of the most &quot;random&quot; ways (of course if you were able to /exactly/ duplicate the circumstances, you&#39;d still get the same result. However it&#39;s much more difficult to duplicate the circumstances with this method.) I&#39;ve seen to generate a number is getting sound input from the mic jack when there&#39;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>