Package squidpony.squidmath
Class CurvedBoundedDistribution
java.lang.Object
squidpony.squidmath.IDistribution.SimpleDistribution
squidpony.squidmath.CurvedBoundedDistribution
- All Implemented Interfaces:
IDistribution
public class CurvedBoundedDistribution extends IDistribution.SimpleDistribution implements IDistribution
An IDistribution that allows a parameter to determine how many calls to
Created by Tommy Ettinger on 11/27/2019.
IRNG.nextDouble()
to make and average
whenever a double is requested. When this parameter degree
is 1, this is uniform; when it is 2, this is a
triangular distribution, and when it is 3 or more it is an increasingly centralized bell curve. The average value is
always very close to 0.5, and the bounds are the same as IRNG.nextDouble()
.
Created by Tommy Ettinger on 11/27/2019.
-
Nested Class Summary
Nested classes/interfaces inherited from interface squidpony.squidmath.IDistribution
IDistribution.SimpleDistribution
-
Field Summary
Fields Modifier and Type Field Description static CurvedBoundedDistribution
instance
static CurvedBoundedDistribution
instanceGaussianLike
static CurvedBoundedDistribution
instanceTriangular
-
Constructor Summary
Constructors Constructor Description CurvedBoundedDistribution()
CurvedBoundedDistribution(int degree)
-
Method Summary
Modifier and Type Method Description int
getDegree()
double
nextDouble(IRNG rng)
Gets a double betweenIDistribution.getLowerBound()
andIDistribution.getUpperBound()
that obeys this distribution.void
setDegree(int degree)
Methods inherited from class squidpony.squidmath.IDistribution.SimpleDistribution
clampedDistribution, fractionalDistribution, fractionalOffsetDistribution, getLowerBound, getUpperBound
-
Field Details
-
Constructor Details
-
Method Details
-
getDegree
-
setDegree
-
nextDouble
Description copied from interface:IDistribution
Gets a double betweenIDistribution.getLowerBound()
andIDistribution.getUpperBound()
that obeys this distribution.- Specified by:
nextDouble
in interfaceIDistribution
- Parameters:
rng
- an IRNG, such asRNG
orGWTRNG
, that this will get one or more random numbers from- Returns:
- a double within the range of
IDistribution.getLowerBound()
andIDistribution.getUpperBound()
-