## Class ZigguratSampler

• All Implemented Interfaces:
ContinuousSampler, SharedStateContinuousSampler, SharedStateSampler<SharedStateContinuousSampler>
Direct Known Subclasses:
ZigguratSampler.Exponential, ZigguratSampler.NormalizedGaussian

public abstract class ZigguratSampler
extends Object
implements SharedStateContinuousSampler
Modified 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:

1. 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.
2. 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 \
-------------+\
| \


Sampling uses UniformRandomProvider.nextLong().

Since:
1.4
McFarland (2016) JSCS 86, 1281-1294
• ### Nested Class Summary

Nested Classes
Modifier and Type Class Description
static class  ZigguratSampler.Exponential
Modified ziggurat method for sampling from an exponential distributions.
static class  ZigguratSampler.NormalizedGaussian
Modified 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

sample
• ### Methods inherited from interface org.apache.commons.rng.sampling.SharedStateSampler

withUniformRandomProvider