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 CurvedBoundedDistributioninstancestatic CurvedBoundedDistributioninstanceGaussianLikestatic CurvedBoundedDistributioninstanceTriangular -
Constructor Summary
Constructors Constructor Description CurvedBoundedDistribution()CurvedBoundedDistribution(int degree) -
Method Summary
Modifier and Type Method Description intgetDegree()doublenextDouble(IRNG rng)Gets a double betweenIDistribution.getLowerBound()andIDistribution.getUpperBound()that obeys this distribution.voidsetDegree(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:IDistributionGets a double betweenIDistribution.getLowerBound()andIDistribution.getUpperBound()that obeys this distribution.- Specified by:
nextDoublein interfaceIDistribution- Parameters:
rng- an IRNG, such asRNGorGWTRNG, that this will get one or more random numbers from- Returns:
- a double within the range of
IDistribution.getLowerBound()andIDistribution.getUpperBound()
-