title: C++ generate large amounts of random floats(10,000+ numbers) fast
body: <p>For a project I am currently working on I need to generate a large amount of pseudorandom  floating-point numbers, between 0 and 1, in the range of thousands to hundreds of thousands as fast as possible.</p>
  <p>What would the best method for this be?</p>
  <p>The options I can think of currently are:</p>
  <p>C <code>rand()</code>, Quite fast from my experience.</p>
  <p>C++11 Random, rather slow but better random numbers from what I have heard.</p>
  <p>A custom hash function such as:</p>
  <pre><code>u_int32_t seed = 1;
  seed = (seed ^ 61) ^ (seed &gt;&gt; 16);
  seed = seed + (seed &lt;&lt; 3);
  seed = seed ^ (seed &gt;&gt; 4);
  seed = seed * 0x27d4eb2d;
  seed = seed ^ (seed &gt;&gt; 15);
  uint8_t a = seed&amp;0xff;
  float n = (((float)a)/UINT8_MAX);
  </code></pre>
  <p>Which is quite fast.</p>
  <p>Speed test for the above:</p>
  <pre><code>Generating 100000 Random Numbers
  C rand(): 1.72661
  C++ random: 6.60626
  hash random: 1.034
  </code></pre>
  <p>Are there any faster options? The only thing I can think of are some quicker hash or somehow doing it on the GPU via a compute shader, but I don't have much experience in that.</p>
  <p>Any help is most appreciated.</p>
  <p>Edit:
  Just to clarify, the times above are in milliseconds.</p>