title: How to use boost normal distribution classes?
body: <p>I'm trying to use boost::normal_distribution in order to generate a normal distribution with mean 0 and sigma 1.</p>
  
  <p>The following code doesn't work as some values are over or beyond -1 and 1 (and shouldn't be). Could someont point out what I am doing wrong?</p>
  
  <pre><code>#include &lt;boost/random.hpp&gt;
  #include &lt;boost/random/normal_distribution.hpp&gt;
  
  int main()
  {
    boost::mt19937 rng; // I don't seed it on purpouse (it's not relevant)
  
    boost::normal_distribution&lt;&gt; nd(0.0, 1.0);
  
    boost::variate_generator&lt;boost::mt19937&amp;, 
                             boost::normal_distribution&lt;&gt; &gt; var_nor(rng, nd);
  
    int i = 0; for (; i &lt; 10; ++i)
    {
      double d = var_nor();
      std::cout &lt;&lt; d &lt;&lt; std::endl;
    }
  }
  </code></pre>
  
  <p>The result on my machine is:</p>
  
  <pre><code>0.213436
  -0.49558
  1.57538
  -1.0592
  1.83927
  1.88577
  0.604675
  -0.365983
  -0.578264
  -0.634376
  </code></pre>
  
  <p>As you can see all values are not between -1 and 1.</p>
  
  <p>Thank you all in advance!</p>
  
  <p><strong>EDIT</strong>: This is what happens when you have deadlines and avoid studying the theory before doing the practice.</p>