public class ZigguratNormalizedGaussianSampler extends Object implements NormalizedGaussianSampler, SharedStateContinuousSampler
The algorithm is explained in this paper and this implementation has been adapted from the C code provided therein.
Sampling uses:
Constructor and Description |
---|
ZigguratNormalizedGaussianSampler(UniformRandomProvider rng) |
Modifier and Type | Method and Description |
---|---|
static <S extends NormalizedGaussianSampler & SharedStateContinuousSampler> |
of(UniformRandomProvider rng)
Create a new normalised Gaussian sampler.
|
double |
sample()
Creates a
double sample. |
String |
toString() |
SharedStateContinuousSampler |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
samples, samples
public ZigguratNormalizedGaussianSampler(UniformRandomProvider rng)
rng
- Generator of uniformly distributed random numbers.public double sample()
double
sample.sample
in interface ContinuousSampler
public SharedStateContinuousSampler withUniformRandomProvider(UniformRandomProvider rng)
withUniformRandomProvider
in interface SharedStateSampler<SharedStateContinuousSampler>
rng
- Generator of uniformly distributed random numbers.public static <S extends NormalizedGaussianSampler & SharedStateContinuousSampler> S of(UniformRandomProvider rng)
S
- Sampler type.rng
- Generator of uniformly distributed random numbers.Copyright © 2016–2022 The Apache Software Foundation. All rights reserved.