Package squidpony.squidmath
Interface IDistribution
- All Known Implementing Classes:
BathtubDistribution,CurvedBoundedDistribution,ExponentialDistribution,GaussianDistribution,IDistribution.SimpleDistribution,SpikeDistribution,SpikeDistribution.SimpleSpikeDistribution
public interface IDistribution
A way to take an
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.-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIDistribution.SimpleDistribution -
Method Summary
Modifier and Type Method Description doublegetLowerBound()Gets the lower bound of the distribution.doublegetUpperBound()Gets the upper bound of the distribution.doublenextDouble(IRNG rng)Gets a double betweengetLowerBound()andgetUpperBound()that obeys this distribution.
-
Method Details
-
nextDouble
Gets a double betweengetLowerBound()andgetUpperBound()that obeys this distribution.- Parameters:
rng- an IRNG, such asRNGorGWTRNG, that this will get one or more random numbers from- Returns:
- a double within the range of
getLowerBound()andgetUpperBound()
-
getLowerBound
double getLowerBound()Gets the lower bound of the distribution. The documentation should specify whether the bound is inclusive or exclusive; if unspecified, it can be assumed to be inclusive (likeIRNG.nextDouble()).- Returns:
- the lower bound of the distribution
-
getUpperBound
double getUpperBound()Gets the upper bound of the distribution. The documentation should specify whether the bound is inclusive or exclusive; if unspecified, it can be assumed to be exclusive (likeIRNG.nextDouble()).- Returns:
- the upper bound of the distribution
-