Class ZigguratSampler.NormalizedGaussian
- java.lang.Object
-
- org.apache.commons.rng.sampling.distribution.ZigguratSampler
-
- org.apache.commons.rng.sampling.distribution.ZigguratSampler.NormalizedGaussian
-
- All Implemented Interfaces:
ContinuousSampler,NormalizedGaussianSampler,SharedStateContinuousSampler,SharedStateSampler<SharedStateContinuousSampler>
- Enclosing class:
- ZigguratSampler
public static final class ZigguratSampler.NormalizedGaussian extends ZigguratSampler implements NormalizedGaussianSampler, SharedStateContinuousSampler
Modified ziggurat method for sampling from a Gaussian distribution with mean 0 and standard deviation 1.Note: The algorithm is a modification of the
Marsaglia and Tsang "Ziggurat" method. The modification improves performance of the rejection method used to generate samples at the edge of the ziggurat.- See Also:
NormalizedGaussianSampler,GaussianSampler
-
-
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.NormalizedGaussianof(UniformRandomProvider rng)Create a new normalised Gaussian sampler.doublesample()Creates adoublesample.StringtoString()ZigguratSampler.NormalizedGaussianwithUniformRandomProvider(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 adoublesample.- Specified by:
samplein interfaceContinuousSampler- Returns:
- a sample.
-
withUniformRandomProvider
public ZigguratSampler.NormalizedGaussian 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.- Specified by:
withUniformRandomProviderin interfaceSharedStateSampler<SharedStateContinuousSampler>- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
of
public static ZigguratSampler.NormalizedGaussian of(UniformRandomProvider rng)
Create a new normalised Gaussian sampler.- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
-