public final class NormalDistribution extends Object implements Distribution
Modifier and Type | Field and Description |
---|---|
private double |
mean
Mean value for the generator
|
private Random |
random
The random generator.
|
private double |
stddev
Standard deviation
|
Constructor and Description |
---|
NormalDistribution(double mean,
double stddev,
Random random)
Constructor for Gaussian generator
|
Modifier and Type | Method and Description |
---|---|
double |
explain(double val)
Return the PDF of the generators distribution
|
double |
generate()
Generate a random value with the generators parameters
|
double |
getMean() |
double |
getStddev() |
private static double |
phi(double x)
Standardized Gaussian PDF
|
static double |
phi(double x,
double mu,
double sigma)
Gaussian distribution PDF
|
String |
toString()
Simple toString explaining the distribution parameters.
|
private double mean
private double stddev
private Random random
public NormalDistribution(double mean, double stddev, Random random)
mean
- Meanstddev
- Standard Deviationrandom
- Random generatorprivate static double phi(double x)
x
- query valuepublic static double phi(double x, double mu, double sigma)
x
- query valuemu
- meansigma
- standard distributionpublic double explain(double val)
explain
in interface Distribution
val
- existing valuepublic double generate()
generate
in interface Distribution
public String toString()
toString
in interface Distribution
toString
in class Object
public double getMean()
public double getStddev()