Class LevySampler
java.lang.Object
org.apache.commons.rng.sampling.distribution.LevySampler
- All Implemented Interfaces:
ContinuousSampler, SharedStateContinuousSampler, SharedStateSampler<SharedStateContinuousSampler>
Sampling from a Lévy distribution.
- Since:
- 1.4
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final NormalizedGaussianSamplerGaussian sampler.private final doubleLocation.private final UniformRandomProviderRNG (used for the toString() method).private final doubleScale. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLevySampler(UniformRandomProvider rng, double location, double scale) privateLevySampler(UniformRandomProvider rng, LevySampler source) -
Method Summary
Modifier and TypeMethodDescriptionstatic LevySamplerof(UniformRandomProvider rng, double location, double scale) Create a new Lévy distribution sampler.doublesample()Creates adoublesample.toString()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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ContinuousSampler
samples, samples
-
Field Details
-
gaussian
Gaussian sampler. -
location
private final double locationLocation. -
scale
private final double scaleScale. -
rng
RNG (used for the toString() method).
-
-
Constructor Details
-
LevySampler
- Parameters:
rng- Generator of uniformly distributed random numbers.location- Location of the Lévy distribution.scale- Scale of the Lévy distribution.
-
LevySampler
- Parameters:
rng- Generator of uniformly distributed random numbers.source- Source to copy.
-
-
Method Details
-
sample
public double sample()Creates adoublesample.- Specified by:
samplein interfaceContinuousSampler- Returns:
- a sample.
-
toString
-
withUniformRandomProvider
Create 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>- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
of
Create a new Lévy distribution sampler.- Parameters:
rng- Generator of uniformly distributed random numbers.location- Location of the Lévy distribution.scale- Scale of the Lévy distribution.- Returns:
- the sampler
- Throws:
IllegalArgumentException- ifscale <= 0
-