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 classSpikeDistribution.SimpleSpikeDistributionA 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 SpikeDistributioninstance -
Constructor Summary
Constructors Constructor Description SpikeDistribution() -
Method Summary
Modifier and Type Method Description doublegetLowerBound()Gets the lower bound of the distribution, which is -1, inclusive.doublegetUpperBound()Gets the upper bound of the distribution, which is 1, exclusive.doublenextDouble(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:
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
getLowerBound()andgetUpperBound()
-
getLowerBound
Gets the lower bound of the distribution, which is -1, inclusive.- Specified by:
getLowerBoundin interfaceIDistribution- Returns:
- the lower bound of the distribution
-
getUpperBound
Gets the upper bound of the distribution, which is 1, exclusive.- Specified by:
getUpperBoundin interfaceIDistribution- Returns:
- the upper bound of the distribution
-