ContinuousSampler
, SharedStateContinuousSampler
, SharedStateSampler<SharedStateContinuousSampler>
public class LogNormalSampler extends java.lang.Object implements SharedStateContinuousSampler
Constructor | Description |
---|---|
LogNormalSampler(NormalizedGaussianSampler gaussian,
double scale,
double shape) |
Modifier and Type | Method | Description |
---|---|---|
static SharedStateContinuousSampler |
of(NormalizedGaussianSampler gaussian,
double scale,
double shape) |
Create a new log-normal distribution 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 LogNormalSampler(NormalizedGaussianSampler gaussian, double scale, double shape)
gaussian
- N(0,1) generator.scale
- Scale of the log-normal distribution.shape
- Shape of the log-normal distribution.java.lang.IllegalArgumentException
- if scale < 0
or shape <= 0
.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)
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.java.lang.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 scale, double shape)
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.scale
- Scale of the log-normal distribution.shape
- Shape of the log-normal distribution.java.lang.IllegalArgumentException
- if scale < 0
or shape <= 0
.withUniformRandomProvider(UniformRandomProvider)
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.