public class GaussianDistribution extends java.lang.Object implements IDistribution
NumberTools.sin_(double)
and NumberTools.cos_(double)
, which are approximations), square root and
logarithm calculations, but it only needs to calculate every other number, and it uses a fixed amount of calls to
IRNG.nextDouble()
(for every pair of outputs, it makes two calls to nextDouble()).
IDistribution.SimpleDistribution
Modifier and Type | Field and Description |
---|---|
static GaussianDistribution |
instance |
EXCLUSIVE_ONE, EXCLUSIVE_ZERO
Constructor and Description |
---|
GaussianDistribution()
Creates a Gaussian (normal) distribution with mean of 0 and standard deviation and variance of 1.
|
GaussianDistribution(double mean,
double standardDeviation)
Creates a Gaussian (normal) distribution with specified mean and standard deviation.
|
Modifier and Type | Method and Description |
---|---|
double |
getLowerBound()
The lower inclusive bound is negative infinity.
|
double |
getMean()
Gets the mean value of this distribution (mu).
|
double |
getUpperBound()
The upper inclusive bound is infinity.
|
double |
nextDouble(IRNG rng)
Gets a double between
IDistribution.getLowerBound() and IDistribution.getUpperBound() that obeys this distribution. |
public static final GaussianDistribution instance
public GaussianDistribution()
public GaussianDistribution(double mean, double standardDeviation)
mean
- (equivalent to mu) the value at the center of the distribution; also the most common resultstandardDeviation
- (equivalent to sigma squared) how far and often values should spread out away from the meanpublic double nextDouble(IRNG rng)
IDistribution
IDistribution.getLowerBound()
and IDistribution.getUpperBound()
that obeys this distribution.nextDouble
in interface IDistribution
rng
- an IRNG, such as RNG
or GWTRNG
, that this will get one or more random numbers fromIDistribution.getLowerBound()
and IDistribution.getUpperBound()
, both inclusivepublic double getLowerBound()
getLowerBound
in interface IDistribution
public double getUpperBound()
getUpperBound
in interface IDistribution
public double getMean()
getMean
in interface IDistribution
Copyright © Eben Howard 2012–2022. All rights reserved.