Class ZigguratSampler.Exponential
- java.lang.Object
-
- org.apache.commons.rng.sampling.distribution.ZigguratSampler
-
- org.apache.commons.rng.sampling.distribution.ZigguratSampler.Exponential
-
- All Implemented Interfaces:
ContinuousSampler
,SharedStateContinuousSampler
,SharedStateSampler<SharedStateContinuousSampler>
- Enclosing class:
- ZigguratSampler
public static class ZigguratSampler.Exponential extends ZigguratSampler
Modified ziggurat method for sampling from an exponential distribution.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.commons.rng.sampling.distribution.ZigguratSampler
ZigguratSampler.Exponential, ZigguratSampler.NormalizedGaussian
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ZigguratSampler.Exponential
of(UniformRandomProvider rng)
Create a new exponential sampler withmean = 1
.static ZigguratSampler.Exponential
of(UniformRandomProvider rng, double mean)
Create a new exponential sampler with the specifiedmean
.double
sample()
Creates adouble
sample.String
toString()
ZigguratSampler.Exponential
withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.rng.sampling.distribution.ContinuousSampler
samples, samples
-
-
-
-
Method Detail
-
sample
public double sample()
Creates adouble
sample.- Returns:
- a sample.
-
withUniformRandomProvider
public ZigguratSampler.Exponential withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
of
public static ZigguratSampler.Exponential of(UniformRandomProvider rng)
Create a new exponential sampler withmean = 1
.- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
of
public static ZigguratSampler.Exponential of(UniformRandomProvider rng, double mean)
Create a new exponential sampler with the specifiedmean
.- Parameters:
rng
- Generator of uniformly distributed random numbers.mean
- Mean.- Returns:
- the sampler
- Throws:
IllegalArgumentException
- if the mean is not strictly positive (mean <= 0
)
-
-