Package squidpony.squidmath
Class SpikeDistribution
java.lang.Object
squidpony.squidmath.SpikeDistribution
- All Implemented Interfaces:
IDistribution
public class SpikeDistribution extends Object implements IDistribution
An IDistribution that produces results between -1.0 inclusive and 1.0 exclusive, but is much more likely to produce
results near 0.0, and does not "round off" like a Gaussian curve around the midpoint.
Created by Tommy Ettinger on 11/23/2019.
Created by Tommy Ettinger on 11/23/2019.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SpikeDistribution.SimpleSpikeDistribution
A variant on SpikeDistribution that has its range shrunk and moved from[-1,1)
to[0,1)
.Nested classes/interfaces inherited from interface squidpony.squidmath.IDistribution
IDistribution.SimpleDistribution
-
Field Summary
Fields Modifier and Type Field Description static SpikeDistribution
instance
-
Constructor Summary
Constructors Constructor Description SpikeDistribution()
-
Method Summary
Modifier and Type Method Description double
getLowerBound()
Gets the lower bound of the distribution, which is -1, inclusive.double
getUpperBound()
Gets the upper bound of the distribution, which is 1, exclusive.double
nextDouble(IRNG rng)
Gets a double betweengetLowerBound()
andgetUpperBound()
that obeys this distribution.
-
Field Details
-
Constructor Details
-
SpikeDistribution
public SpikeDistribution()
-
-
Method Details
-
nextDouble
Gets a double betweengetLowerBound()
andgetUpperBound()
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
getLowerBound()
andgetUpperBound()
-
getLowerBound
Gets the lower bound of the distribution, which is -1, inclusive.- Specified by:
getLowerBound
in interfaceIDistribution
- Returns:
- the lower bound of the distribution
-
getUpperBound
Gets the upper bound of the distribution, which is 1, exclusive.- Specified by:
getUpperBound
in interfaceIDistribution
- Returns:
- the upper bound of the distribution
-