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 ExponentialDistribution
instance
static ExponentialDistribution
instance_0_5
static ExponentialDistribution
instance_1_5
-
Constructor Summary
Constructors Constructor Description ExponentialDistribution()
ExponentialDistribution(double lambda)
-
Method Summary
Modifier and Type Method Description double
getLambda()
double
getLowerBound()
The lower inclusive bound is 0 while lambda is positive; it is negative infinity if lambda is negative.double
getUpperBound()
The upper inclusive bound is infinity while lambda is positive; it is 0 if lambda is negative.double
nextDouble(IRNG rng)
Gets a double betweenIDistribution.getLowerBound()
andIDistribution.getUpperBound()
that obeys this distribution.void
setLambda(double lambda)
-
Field Details
-
Constructor Details
-
Method Details
-
getLambda
-
setLambda
-
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()
-
getLowerBound
The lower inclusive bound is 0 while lambda is positive; it is negative infinity if lambda is negative.- Specified by:
getLowerBound
in 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:
getUpperBound
in interfaceIDistribution
- Returns:
- positive infinity, or zero if lambda is negative.
-