Random: nextGaussian() : Random « java.util « Java by API






Random: nextGaussian()

 
/*
 * Output:
0.9858761222419792
-1.0868562994825026
-1.2801148369647788
0.03988775024786847
-1.8662098370799078
-0.12277520073012224
0.0911032879532435
-0.0804314384368678
-2.3955991772544114
-1.857516970646183
 */

import java.util.Random;

public class MainClass {

  public static void main(String args[]) {
  
    Random generator = new Random();
    for(int i = 0; i < 10; i++) {
      System.out.println(generator.nextGaussian());
    }

  }
}
           
         
  








Related examples in the same category

1.new Random(int intValue)
2.Random: nextInt()
3.Random: nextDouble
4.Random: nextLong()
5.Vector: removeElementAt(int index)