title: Random Normal Distribution in Java returns values outside range
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/629798/problem-with-random-nextgaussian">problem with Random.nextGaussian()</a>  </p>
  </blockquote>
  
  
  
  <p>I am working to develop small java application to make random normal distribution and give 50 values.  I use mean = 0.0 and std = 1.0, but the problem I got results out of the bounds there is some values less than 0.0 and else more than 1.0 , can anyone help me?</p>
  
  <p>The following is the code that I used:</p>
  
  <pre><code>public static void main(String[] args) {
  
      double[] list = new double[50];
      double mean = 0.0, std = 1.0;
      Random rng = new Random();
  
              // to generate 50 values random normal distribution
      for(int i = 0;i&lt;list.length;i++) {
        list[i] = mean + std * rng.nextGaussian();
      }
  
              // to print the generated values from the list
      for(int i = 0;i&lt;list.length;i++) 
              {
              System.out.println(list[i]); 
      }
  
  
  }
  </code></pre>