- All Implemented Interfaces:
public abstract class ZigguratSampler extends Object implements SharedStateContinuousSamplerModified ziggurat method for sampling from Gaussian and exponential distributions.
Uses the algorithm from:
McFarland, C.D. (2016)
"A modified ziggurat algorithm for generating exponentially and normally distributed pseudorandom numbers".
Journal of Statistical Computation and Simulation 86, 1281-1294.
Note: The algorithm is a modification of the
Marsaglia and Tsang "Ziggurat" method. The modification improves performance by:
- Creating layers of the ziggurat entirely inside the probability density function (area B); this allows the majority of samples to be obtained without checking if the value is in the region of the ziggurat layer that requires a rejection test.
- For samples not within the main ziggurat (area A) alias sampling is used to choose a layer and rejection of points above the PDF is accelerated using precomputation of triangle regions entirely below or above the curve.
\ ----------+\ | \ B |A \ -------------+\ | \
- See Also:
- McFarland (2016) JSCS 86, 1281-1294
Nested Class Summary
Nested Classes Modifier and Type Class Description
ZigguratSampler.ExponentialModified ziggurat method for sampling from an exponential distributions.
ZigguratSampler.NormalizedGaussianModified ziggurat method for sampling from a Gaussian distribution with mean 0 and standard deviation 1.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.commons.rng.sampling.distribution.ContinuousSampler