public class LogNormalSampler extends Object implements SharedStateContinuousSampler
Constructor and Description |
---|
LogNormalSampler(NormalizedGaussianSampler gaussian,
double mu,
double sigma) |
Modifier and Type | Method and Description |
---|---|
static SharedStateContinuousSampler |
of(NormalizedGaussianSampler gaussian,
double mu,
double sigma)
Create a new log-normal distribution 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 LogNormalSampler(NormalizedGaussianSampler gaussian, double mu, double sigma)
gaussian
- N(0,1) generator.mu
- Mean of the natural logarithm of the distribution values.sigma
- Standard deviation of the natural logarithm of the distribution values.IllegalArgumentException
- if sigma <= 0
.public double sample()
double
sample.sample
in interface ContinuousSampler
public SharedStateContinuousSampler withUniformRandomProvider(UniformRandomProvider rng)
Note: This function is available if the underlying NormalizedGaussianSampler
is a SharedStateSampler
.
Otherwise a run-time exception is thrown.
withUniformRandomProvider
in interface SharedStateSampler<SharedStateContinuousSampler>
rng
- Generator of uniformly distributed random numbers.UnsupportedOperationException
- if the underlying sampler is not a
SharedStateSampler
or
does not return a NormalizedGaussianSampler
when sharing state.public static SharedStateContinuousSampler of(NormalizedGaussianSampler gaussian, double mu, double sigma)
Note: The shared-state functionality is available if the NormalizedGaussianSampler
is a SharedStateSampler
.
Otherwise a run-time exception will be thrown when the sampler is used to share state.
gaussian
- N(0,1) generator.mu
- Mean of the natural logarithm of the distribution values.sigma
- Standard deviation of the natural logarithm of the distribution values.IllegalArgumentException
- if sigma <= 0
.withUniformRandomProvider(UniformRandomProvider)
Copyright © 2016–2022 The Apache Software Foundation. All rights reserved.