ContinuousSampler
, NormalizedGaussianSampler
, SharedStateContinuousSampler
, SharedStateSampler<SharedStateContinuousSampler>
public class ZigguratNormalizedGaussianSampler extends java.lang.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:
UniformRandomProvider.nextLong()
UniformRandomProvider.nextDouble()
Constructor | Description |
---|---|
ZigguratNormalizedGaussianSampler(org.apache.commons.rng.UniformRandomProvider rng) |
Modifier and Type | Method | Description |
---|---|---|
static <S extends NormalizedGaussianSampler & SharedStateContinuousSampler> |
of(org.apache.commons.rng.UniformRandomProvider rng) |
Create a new normalised Gaussian sampler.
|
double |
sample() |
Creates a sample.
|
java.lang.String |
toString() |
|
SharedStateContinuousSampler |
withUniformRandomProvider(org.apache.commons.rng.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.
|
public ZigguratNormalizedGaussianSampler(org.apache.commons.rng.UniformRandomProvider rng)
rng
- Generator of uniformly distributed random numbers.public double sample()
sample
in interface ContinuousSampler
public java.lang.String toString()
toString
in class java.lang.Object
public SharedStateContinuousSampler withUniformRandomProvider(org.apache.commons.rng.UniformRandomProvider rng)
withUniformRandomProvider
in interface SharedStateSampler<SharedStateContinuousSampler>
rng
- Generator of uniformly distributed random numbers.public static <S extends NormalizedGaussianSampler & SharedStateContinuousSampler> S of(org.apache.commons.rng.UniformRandomProvider rng)
S
- Sampler type.rng
- Generator of uniformly distributed random numbers.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.