title: Why is Google Chrome's Math.random number generator not *that* random?
body: <p>I ran into an odd "bug" today when I was running some unit tests in various browsers. I had run the tests in Firefox many times before today, and even IE but apparently not Chrome (v19-dev) yet. When I ran them in Chrome it consistently failed one test because two values I was calculating did not match.</p>
  
  <p>When I really dug into what was happening I realized that the issue was that I was assuming that if I filled an array with 100,000 <code>Math.random()</code> values that they would all be unique (there wouldn't be any collisions). Turned out that in Chrome that is not true.</p>
  
  <p>In Chrome I was consistently getting at least <em>two</em> pairs of values that matched out of 100,000. Firefox and IE9 never experience a collision. Here is a jsfiddle I wrote just for testing this that creates 1M <code>Math.random()</code> entries in an array: <a href="http://jsfiddle.net/pseudosavant/bcduj/" rel="noreferrer">http://jsfiddle.net/pseudosavant/bcduj/</a></p>
  
  <p>Does anyone know why the Chrome pseudo-random number generator that is used for <code>Math.random</code> is really not <em>that</em> random? It seems like this could have implications for any client-side js encryption routines that ever use <code>Math.random</code>.</p>