Package squidpony.squidmath
Class ExponentialDistribution
java.lang.Object
squidpony.squidmath.ExponentialDistribution
- All Implemented Interfaces:
IDistribution
public class ExponentialDistribution extends Object implements IDistribution
An IDistribution that implements the Exponential
distribution. Takes lambda as a parameter during construction (default 1), and lambda also has getters/setters.
Created by Tommy Ettinger on 11/23/2019.
Created by Tommy Ettinger on 11/23/2019.
-
Nested Class Summary
Nested classes/interfaces inherited from interface squidpony.squidmath.IDistribution
IDistribution.SimpleDistribution -
Field Summary
Fields Modifier and Type Field Description static ExponentialDistributioninstancestatic ExponentialDistributioninstance_0_5static ExponentialDistributioninstance_1_5 -
Constructor Summary
Constructors Constructor Description ExponentialDistribution()ExponentialDistribution(double lambda) -
Method Summary
Modifier and Type Method Description doublegetLambda()doublegetLowerBound()The lower inclusive bound is 0 while lambda is positive; it is negative infinity if lambda is negative.doublegetUpperBound()The upper inclusive bound is infinity while lambda is positive; it is 0 if lambda is negative.doublenextDouble(IRNG rng)Gets a double betweenIDistribution.getLowerBound()andIDistribution.getUpperBound()that obeys this distribution.voidsetLambda(double lambda)
-
Field Details
-
Constructor Details
-
Method Details
-
getLambda
-
setLambda
-
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()
-
getLowerBound
The lower inclusive bound is 0 while lambda is positive; it is negative infinity if lambda is negative.- Specified by:
getLowerBoundin interfaceIDistribution- Returns:
- zero, or negative infinity if lambda is negative.
-
getUpperBound
The upper inclusive bound is infinity while lambda is positive; it is 0 if lambda is negative.- Specified by:
getUpperBoundin interfaceIDistribution- Returns:
- positive infinity, or zero if lambda is negative.
-