public interface IDistribution
IRNG
and get one or more random numbers from it to produce a double in some statistical
distribution, such as Gaussian (also called the normal distribution), exponential, or various simpler schemes that
don't have common mathematical names. An example of the last category is "spike" for a distribution that is very
likely to be 0 and quickly drops off to being less likely for positive or negative results between 0 and -1 or 1, or
"bathtub" for the "spike" distribution's fractional part from 0 to 1 (which is likely to be 0 or 1 and very unlikely
to be near 0.5).
Created by Tommy Ettinger on 11/23/2019.Modifier and Type | Interface and Description |
---|---|
static class |
IDistribution.SimpleDistribution
An abstract IDistribution that always has a lower bound of 0.0 and an upper bound of
EXCLUSIVE_ONE ,
matching the bounds of IRNG.nextDouble() . |
Modifier and Type | Field and Description |
---|---|
static double |
EXCLUSIVE_ONE
A double that is less than 1.0 by the smallest representable amount.
|
static double |
EXCLUSIVE_ZERO
A double that is greater than 0.0 by the smallest representable amount.
|
Modifier and Type | Method and Description |
---|---|
double |
getLowerBound()
Gets the lower inclusive bound of the distribution.
|
double |
getMean()
Gets the mean value of this distribution.
|
double |
getUpperBound()
Gets the upper inclusive bound of the distribution.
|
double |
nextDouble(IRNG rng)
Gets a double between
getLowerBound() and getUpperBound() that obeys this distribution. |
static final double EXCLUSIVE_ZERO
Double.MIN_VALUE
.static final double EXCLUSIVE_ONE
0.9999999999999999
.double nextDouble(IRNG rng)
getLowerBound()
and getUpperBound()
that obeys this distribution.rng
- an IRNG, such as RNG
or GWTRNG
, that this will get one or more random numbers fromgetLowerBound()
and getUpperBound()
, both inclusivedouble getLowerBound()
EXCLUSIVE_ZERO
.double getUpperBound()
IRNG.nextDouble()
), then this will be EXCLUSIVE_ONE
.double getMean()
Copyright © Eben Howard 2012–2022. All rights reserved.