dimanche 15 juillet 2018

nextGaussian in java

I read the documentation of java and it clearly said that nextGaussian resturns a gaussian double value with mean =0 and variance 1. As we know the gaussian distribution values is between 0 and 1. but when i run this code.

double variance=1;
double mean=0;
System.out.println(gau);
double noise=r.nextGaussian();*Math.sqrt(variance)+mean;
System.out.println(noise);

It gives me negative values and values more than 1 also. What am i missing here? Please help.




Aucun commentaire:

Enregistrer un commentaire