title: Boost C++ - generating a random real number between 0 and 1
body: <p>I've been reading the Boost C++ documentation and trying to figure out how to generate a random real number between 0 and 1, using the <code>uniform_01</code> part of the library. Does anyone have any suggestions?</p>
  
  <p>Based on suggestions, I'm using this code, but it generates the same random value every time. </p>
  
  <pre><code>double random01(mt19937 &amp; generator)
  {
      uniform_01&lt;mt19937&gt; dist(generator);
      return dist();
  }
  
  int main()
  {
      mt19937 generator(time(0));
      for (int i = 0; i &lt; 10; i++) {
          cout &lt;&lt; random01(generator) &lt;&lt; endl;
      }
      return 0;
  }
  </code></pre>
  
  <p>Sorry if I wasn't clear; this question isn't solved, by my answer or any other. It's still generating the same random value each time.</p>