Java API Tutorial - Java Random.nextGaussian()








Syntax

Random.nextGaussian() has the following syntax.

public double nextGaussian()

Example

In the following code shows how to use Random.nextGaussian() method.

/*w  w w.  j  a va  2  s  .c  o  m*/

import java.util.Random;

public class Main {
   public static void main( String args[] ){

      Random randomno = new Random();
 
      // check next Gaussian value  
      System.out.println("Next Gaussian value: " + randomno.nextGaussian());
   }      
}

The code above generates the following result.