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