Standard Gaussian - Java Algorithm

Java examples for Algorithm:Statistics

Description

Standard Gaussian

Demo Code



public class StdGaussian {
    public static void main(String args[]) {
        double u = Math.random();
        double v = Math.random();
        double z = 0;
        z = (Math.sin(Math.PI * 2 * v)) * (Math.sqrt(-2 * Math.log(u)));
        System.out.println(z);/*from  w  w w  .j  a  v  a2s . c o  m*/
    }

}

Related Tutorials