Class UniformLongSampler.LargeRangeUniformLongSampler
java.lang.Object
org.apache.commons.rng.sampling.distribution.UniformLongSampler
org.apache.commons.rng.sampling.distribution.UniformLongSampler.LargeRangeUniformLongSampler
- All Implemented Interfaces:
LongSampler
,SharedStateLongSampler
,SharedStateSampler<SharedStateLongSampler>
- Enclosing class:
UniformLongSampler
private static final class UniformLongSampler.LargeRangeUniformLongSampler
extends UniformLongSampler
Discrete uniform distribution sampler when the range between lower and upper is too large
to fit in a positive long.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long
Lower bound.private final long
Upper bound.Fields inherited from class org.apache.commons.rng.sampling.distribution.UniformLongSampler
rng
-
Constructor Summary
ConstructorsConstructorDescriptionLargeRangeUniformLongSampler
(UniformRandomProvider rng, long lower, long upper) -
Method Summary
Modifier and TypeMethodDescriptionlong
sample()
Creates along
sample.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 org.apache.commons.rng.sampling.distribution.UniformLongSampler
of, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.commons.rng.sampling.distribution.LongSampler
samples, samples
-
Field Details
-
lower
private final long lowerLower bound. -
upper
private final long upperUpper bound.
-
-
Constructor Details
-
LargeRangeUniformLongSampler
LargeRangeUniformLongSampler(UniformRandomProvider rng, long lower, long upper) - Parameters:
rng
- Generator of uniformly distributed random numbers.lower
- Lower bound (inclusive) of the distribution.upper
- Upper bound (inclusive) of the distribution.
-
-
Method Details
-
sample
public long sample()Description copied from interface:LongSampler
Creates along
sample.- Returns:
- a sample.
-
withUniformRandomProvider
Description copied from class:UniformLongSampler
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:
withUniformRandomProvider
in interfaceSharedStateSampler<SharedStateLongSampler>
- Specified by:
withUniformRandomProvider
in classUniformLongSampler
- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-