25package umontreal.ssj.randvar;
27import umontreal.ssj.rng.*;
28import umontreal.ssj.probdist.*;
41 private boolean available =
false;
42 private double[] variates =
new double[2];
43 private static double[] staticVariates =
new double[2];
76 return mu + sigma * variates[1];
78 boxMuller(stream, mu, sigma, variates);
80 return mu + sigma * variates[0];
90 boxMuller(s, mu, sigma, staticVariates);
91 return mu + sigma * staticVariates[0];
95 private static void boxMuller(
RandomStream stream,
double mu,
double sigma,
double[] variates) {
96 final double pi = Math.PI;
101 s = Math.sqrt(-2.0 * Math.log(u));
102 variates[1] = s * Math.sin(2 * pi * v);
103 variates[0] = s * Math.cos(2 * pi * v);
Extends the class ContinuousDistribution for the normal distribution (e.g., tjoh95a (page 80)).
NormalBoxMullerGen(RandomStream s, NormalDist dist)
Creates a random variate generator for the normal distribution dist and stream s.
NormalBoxMullerGen(RandomStream s)
Creates a standard normal random variate generator with mean 0 and standard deviation 1,...
static double nextDouble(RandomStream s, double mu, double sigma)
Generates a variate from the normal distribution with parameters  mu and  sigma,...
double nextDouble()
Generates a random number from the continuous distribution contained in this object.
NormalBoxMullerGen(RandomStream s, double mu, double sigma)
Creates a normal random variate generator with mean mu and standard deviation sigma,...
void setParams(double mu, double sigma)
Sets the parameters and of this object.
NormalGen(RandomStream s, double mu, double sigma)
Creates a normal random variate generator with mean mu and standard deviation sigma,...
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...
double nextDouble()
Returns a (pseudo)random number from the uniform distribution over the interval , using this stream,...