Class StableSampler.GaussianStableSampler
java.lang.Object
org.apache.commons.rng.sampling.distribution.StableSampler
org.apache.commons.rng.sampling.distribution.StableSampler.GaussianStableSampler
- All Implemented Interfaces:
ContinuousSampler, SharedStateContinuousSampler, SharedStateSampler<SharedStateContinuousSampler>
- Enclosing class:
StableSampler
Implement the
alpha = 2 stable distribution case (Gaussian distribution).- Since:
- 1.4
-
Nested Class Summary
Nested classes/interfaces inherited from class StableSampler
StableSampler.Alpha1CMSStableSampler, StableSampler.Beta0CMSStableSampler, StableSampler.Beta0WeronStableSampler, StableSampler.CMSStableSampler, StableSampler.SpecialMath, StableSampler.WeronStableSampler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleThe mean.private static final doublesqrt(2).private final NormalizedGaussianSamplerUnderlying normalized Gaussian sampler.private final doubleThe standard deviation. -
Constructor Summary
ConstructorsConstructorDescriptionGaussianStableSampler(UniformRandomProvider rng, double gamma, double delta) -
Method Summary
Modifier and TypeMethodDescriptiondoublesample()Generate a sample from a stable distribution.Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.Methods inherited from class StableSampler
nextLong, of, of, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ContinuousSampler
samples, samples
-
Field Details
-
ROOT_2
private static final double ROOT_2sqrt(2). -
sampler
Underlying normalized Gaussian sampler. -
stdDev
private final double stdDevThe standard deviation. -
mean
private final double meanThe mean.
-
-
Constructor Details
-
GaussianStableSampler
GaussianStableSampler(UniformRandomProvider rng, double gamma, double delta) - Parameters:
rng- Underlying source of randomnessgamma- Scale parameter. Must be strictly positive.delta- Location parameter.
-
GaussianStableSampler
GaussianStableSampler(UniformRandomProvider rng, StableSampler.GaussianStableSampler source) - Parameters:
rng- Underlying source of randomnesssource- Source to copy.
-
-
Method Details
-
sample
public double sample()Description copied from class:StableSamplerGenerate a sample from a stable distribution.The distribution uses the 0-parameterization: S(alpha, beta, gamma, delta; 0).
- Specified by:
samplein interfaceContinuousSampler- Specified by:
samplein classStableSampler- Returns:
- a sample.
-
withUniformRandomProvider
Description copied from class:StableSamplerCreate a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProviderin interfaceSharedStateSampler<SharedStateContinuousSampler>- Specified by:
withUniformRandomProviderin classStableSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-