title: how to use std::generate_canonical to generate random number in range [0,1)?
body: <p>I am running into an issue when trying to use <code>std::generate_canonical</code>. From my reading at <a href="http://en.cppreference.com/w/cpp/numeric/random/generate_canonical" rel="nofollow noreferrer">cpp-reference.com</a>, I expect <code>std::generate_canonical</code> to generate numbers in the range [0,1).
  However, on an up-to-date MSVC 2012 (CTP not installed), <code>std::generate_canonical</code> generates numbers that are all of the order 10^28 (see below). Indeed, <a href="http://msdn.microsoft.com/en-us/library/ee462289.aspx" rel="nofollow noreferrer">Microsoft's documentation</a> does not mention the range in which <code>std::generate_canonical</code> generates numbers.</p>
  
  <p>Does Microsoft not comply with the standard here? Or is the standard deficient in that it is vague about <code>std::generate_canonical</code>'s behavior? In the second case, how would I write code to generate a random floating point number in the range [0,1)?</p>
  
  <p>Please consider the below example code for my attempt at using <code>std::generate_canonical</code>.</p>
  
  <pre><code>#include &lt;random&gt;
  #include &lt;limits&gt;
  #include &lt;iostream&gt;
  
  int main(int argc, char* argv[])
  {
      std::random_device rd;
      // seed with true source of randomness
      std::mt19937 _rng_generator(rd());
  
      for(int n=0; n&lt;10; ++n)
          std::cout &lt;&lt; std::generate_canonical&lt;double,std::numeric_limits&lt;double&gt;::digits&gt;(_rng_generator) &lt;&lt; ' ';
  
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>Example of the output I get:<br>
      <code>4.85267e+028 2.76741e+028 3.17392e+028 5.84136e+028 1.0037e+028 4.87202e+028 2.53834e+028 4.233e+028 6.43922e+028 2.30694e+028</code></p>
  
  <p><strong>Update:</strong>
  I have previously reported the bug to <a href="https://connect.microsoft.com/VisualStudio/feedback/details/811611/std-generate-canonical-does-not-generate-random-number-in-range-0-1" rel="nofollow noreferrer">Microsoft Connect</a>. The bug has now been fixed and the fix will be included in MSVC 2014 RTM.</p>