title: How random is arc4random (mac os x)? (or what am I doing wrong?)
body: <p>I'm playing with an optimized game of life implementation in swift/mac_os_x.  First step: randomize a big grid of cells (50% alive).</p>
  
  <p>code:</p>
  
  <pre><code>for(var i=0;i&lt;768;i++){
    for(var j=0;j&lt;768;j++){
      let r = Int(arc4random_uniform(100))
      let alive = (aliveOdds &gt; r)
      self.setState(alive,cell: Cell(tup:(i,j)),cells: aliveCells)
    }
  }
  </code></pre>
  
  <p>I expect a relatively uniform randomness.  What I get has definite patterns:</p>
  
  <p><img src="https://i.stack.imgur.com/QUU19.jpg" alt="Large image"></p>
  
  <p>Zooming in a bit on the lower left:</p>
  
  <p><img src="https://i.stack.imgur.com/mbDLm.jpg" alt="zoomed in"></p>
  
  <p>(I've changed the color to black on every 32 row and column, to see if the patterns lined up with any power of 2).</p>
  
  <p>Any clue what is causing the patterns?  I've tried:</p>
  
  <ul>
  <li>replacing arc4random with <code>rand()</code>.</li>
  <li>adding <code>arc4stir()</code> before each arc4random_uniform call</li>
  <li>shifting the display (to ensure the pattern is in the data, not a display glitch)</li>
  </ul>
  
  <p>Ideas on next steps?  </p>