public abstract static class IDistribution.SimpleDistribution extends java.lang.Object implements IDistribution
IDistribution.EXCLUSIVE_ONE
,
matching the bounds of IRNG.nextDouble()
. This provides methods to create SimpleDistribution instances
from arbitrary IDistribution instances.IDistribution.SimpleDistribution
EXCLUSIVE_ONE, EXCLUSIVE_ZERO
Constructor and Description |
---|
SimpleDistribution() |
Modifier and Type | Method and Description |
---|---|
static IDistribution.SimpleDistribution |
clampedDistribution(IDistribution otherDistribution)
Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite
bounds) by simply clamping results that are below 0 to 0 and at least 1 to 0.9999999999999999 (the largest
double less than 1.0 than can be represented).
|
static IDistribution.SimpleDistribution |
fractionalDistribution(IDistribution otherDistribution)
Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite
bounds) by getting the fractional component of a result from
otherDistribution . |
static IDistribution.SimpleDistribution |
fractionalOffsetDistribution(IDistribution otherDistribution,
double offset)
Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite
bounds) by getting the fractional component of
offset plus a result from otherDistribution . |
double |
getLowerBound()
Gets the lower inclusive bound, which is 0.0.
|
double |
getMean()
Gets the mean value of this distribution, which by default is
Double.NaN . |
double |
getUpperBound()
Gets the upper inclusive bound of the distribution, which is 0.9999999999999999 (
IDistribution.EXCLUSIVE_ONE ). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
nextDouble
public static IDistribution.SimpleDistribution fractionalDistribution(IDistribution otherDistribution)
otherDistribution
.otherDistribution
- any other IDistributionotherDistribution
.public static IDistribution.SimpleDistribution fractionalOffsetDistribution(IDistribution otherDistribution, double offset)
offset
plus a result from otherDistribution
.
Using the offset allows distributions like GaussianDistribution
, which are centered on 0.0, to become
centered halfway on 0.5, making the result of this distribution have a Gaussian-like peak on 0.5 instead of
peaking at the bounds when offset is 0.0.otherDistribution
- any other IDistributionotherDistribution
.public static IDistribution.SimpleDistribution clampedDistribution(IDistribution otherDistribution)
fractionalOffsetDistribution(IDistribution, double)
.otherDistribution
- any other IDistributionotherDistribution
in range.public double getLowerBound()
getLowerBound
in interface IDistribution
public double getUpperBound()
IDistribution.EXCLUSIVE_ONE
).getUpperBound
in interface IDistribution
public double getMean()
Double.NaN
. Implementing classes are
strongly advised to override this and provide a meaningful estimate (at least) of the mean.getMean
in interface IDistribution
Double.NaN
)Copyright © Eben Howard 2012–2022. All rights reserved.