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.
- Since:
- 1.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longLower bound.private final longUpper bound.Fields inherited from class UniformLongSampler
rng -
Constructor Summary
ConstructorsConstructorDescriptionLargeRangeUniformLongSampler(UniformRandomProvider rng, long lower, long upper) -
Method Summary
Modifier and TypeMethodDescriptionlongsample()Creates alongsample.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 UniformLongSampler
of, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface 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:LongSamplerCreates alongsample.- Returns:
- a sample.
-
withUniformRandomProvider
Description copied from class:UniformLongSamplerCreate 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<SharedStateLongSampler>- Specified by:
withUniformRandomProviderin classUniformLongSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-