title: Can a cryptographic hash algorithm be used as a PRNG?
body: <p>Can MD5/SHA256/SHA512, etc., be used as a PRNG? E.g., given an integer seed, is the pseudo-code:</p>
  
  <pre><code>random_number = truncate_to_desired_range(
      sha512( seed.toString() + ',' + i.toString() )
  </code></pre>
  
  <p>…a decent PRNG? (<code>i</code> is an increasing integer, e.g., the outputs are:</p>
  
  <pre><code>convert(sha512("&lt;seed&gt;,0"))
  convert(sha512("&lt;seed&gt;,1"))
  convert(sha512("&lt;seed&gt;,2"))
  convert(sha512("&lt;seed&gt;,3"))
  …
  </code></pre>
  
  <p>"Decent", in the context of this question, refers only to the distribution of the output: is the output of cryptographic hash functions uniform, when used this way? (Though I suppose it would depend on the hash function, all cryptographic hashes should also have uniform output, right?)</p>
  
  <p><strong>Note:</strong> I will concede that this is going to be a slow PRNG, compared to say Mersenne-Twister, due to the use of a cryptographic hash. I'm not interested in speed, and I'm not interested in the result being secure — just that the distribution is correct.</p>
  
  <p>In my particular use case, I'm looking for something similar to <a href="http://xkcd.com/426/" rel="nofollow">XKCD's geohashing</a>, in that it is easily implemented by distributed parties, who will all arrive at the same answer. Mersenne-Twister can be substituted, but it less available in many target languages. (Some languages lack it entirely, some lack access to the raw U32 output of it, etc. SHA512 is either built in, or easily available.)</p>