public class MarsagliaNormalizedGaussianSampler extends Object implements NormalizedGaussianSampler, SharedStateContinuousSampler
BoxMullerNormalizedGaussianSampler
.
Sampling uses UniformRandomProvider.nextDouble()
.
Constructor and Description |
---|
MarsagliaNormalizedGaussianSampler(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 MarsagliaNormalizedGaussianSampler(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.