Package org.evoludo.math
Class RNGDistribution.Exponential
Object
RNGDistribution
Exponential
- Enclosing class:
- RNGDistribution
Exponentially distributed random numbers with support
 
[0.0, Double.MAX_VALUE).- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class RNGDistributionRNGDistribution.Binomial, RNGDistribution.Exponential, RNGDistribution.Geometric, RNGDistribution.Gillespie, RNGDistribution.Normal, RNGDistribution.TestCommand, RNGDistribution.Uniform
- 
Field SummaryFieldsFields inherited from class RNGDistributionrng, seed, seedSet, testSamples
- 
Constructor SummaryConstructorsConstructorDescriptionCreates exponential distribution withmean==1and a new instance ofMersenneTwister.Exponential(double mean) Creates exponential distribution withmeanand a new instance ofMersenneTwister.Exponential(MersenneTwister rng, double mean) Creates exponential distribution withmeanand random number generatorrng.
- 
Method SummaryModifier and TypeMethodDescriptionprivate static doublecdf(double x, double mean) Helper method to calculate the cumulative distribution function,cdf, of the Exponential distribution.clone()Clone this RNGDistribution to ensure both objects return identical sequences of random numbers.doublegetMean()Get the mean of the exponential distribution.doublenext()Generate an exponentially distributed random number withmean.static doublenext(MersenneTwister rng, double mean) Exponentially distributed random number withmeanusing random number generatorrng.static voidtest(MersenneTwister rng, Logger logger, MersenneTwister.Chronometer clock) Test Exponential distribution.Methods inherited from class RNGDistributionclearRNGSeed, clone, getRNG, getRNGSeed, isRNGSeedSet, nextBoolean, nextByte, nextBytes, nextDouble, nextGaussian, nextInt, nextInt, random01, random01d, random0n, random0N, setRNG, setRNGSeed, setRNGSeed
- 
Field Details- 
meanprivate double meanThe mean of exponential distribution.
 
- 
- 
Constructor Details- 
Exponentialpublic Exponential()Creates exponential distribution withmean==1and a new instance ofMersenneTwister.
- 
Exponentialpublic Exponential(double mean) Creates exponential distribution withmeanand a new instance ofMersenneTwister.- Parameters:
- mean- the mean of the exponential distribution
 
- 
ExponentialCreates exponential distribution withmeanand random number generatorrng.- Parameters:
- rng- the random number generator
- mean- the mean of the exponential distribution
- Throws:
- IllegalArgumentException- if- mean≤0
- See Also:
 
 
- 
- 
Method Details- 
getMeanpublic double getMean()Get the mean of the exponential distribution.- Returns:
- the mean
 
- 
nextpublic double next()Generate an exponentially distributed random number withmean.- Returns:
- the exponentially distributed random number
 
- 
cloneDescription copied from class:RNGDistributionClone this RNGDistribution to ensure both objects return identical sequences of random numbers.IMPORTANT: - Specified by:
- clonein class- RNGDistribution
- Returns:
- clone of RNGDistribution
 
- 
nextExponentially distributed random number withmeanusing random number generatorrng.Note: no performance difference between the instance method next()and this static counterpart.- Parameters:
- rng- random number generator
- mean- of exponential distribution
- Returns:
- exponentially distributed random number with mean
- Throws:
- IllegalArgumentException- if- man≤0
 
- 
testTest Exponential distribution.The test samples the distribution and bins the random numbers. This sample distribution is compared to the theoretical expectation. The mean deviation is the mean difference between the actual number of events in each bin and their expected number. For a perfect match the mean deviation is 0. The test passes if the mean deviation lies within one standard error from0. This is more stringent than the traditional 95% confidence interval.- Parameters:
- rng- the random number generator
- logger- the logger for reporting results
- clock- the stop watch
- See Also:
 
- 
cdfprivate static double cdf(double x, double mean) Helper method to calculate the cumulative distribution function,cdf, of the Exponential distribution.- Parameters:
- x- the value for which to calculate the- cdf
- mean- the mean value
- Returns:
- cdfat- x
 
 
-