title: Computer clock as pseudo-random generator
body: <p>Most modern computers exhibit non deterministic behavior, what makes impossible to tell how many clock cycles will occur between two consecutive calls to read the computer clock.</p>
  
  <p>The following code is a pseudo random number generator for one byte using the computer clock.</p>
  
  <pre><code>unsigned long occurrences = 0;
  unsigned long total = 0;
  
  while (true) {
      if ((clock() &amp; 0xFF) == 60) // testing ocurrences for a given number, 60 for instance
          occurrences++;
      total++;
      printf("%f\n", (float)occurrences / (float)total ); // this should be approximately 1/256 = 0.00390625
  }
  </code></pre>
  
  <p>Excluding serious applications like encription for instance, it could be used in mobile platforms for games.</p>
  
  <p>I wonder what could be the advantages and disadvantages of such implementation.</p>