Class FastLoadedDiceRollerDiscreteSampler.FixedValueDiscreteSampler
java.lang.Object
org.apache.commons.rng.sampling.distribution.FastLoadedDiceRollerDiscreteSampler
org.apache.commons.rng.sampling.distribution.FastLoadedDiceRollerDiscreteSampler.FixedValueDiscreteSampler
- All Implemented Interfaces:
DiscreteSampler
,SharedStateDiscreteSampler
,SharedStateSampler<SharedStateDiscreteSampler>
- Enclosing class:
FastLoadedDiceRollerDiscreteSampler
private static final class FastLoadedDiceRollerDiscreteSampler.FixedValueDiscreteSampler
extends FastLoadedDiceRollerDiscreteSampler
Class to handle the edge case of observations in only one category.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.commons.rng.sampling.distribution.FastLoadedDiceRollerDiscreteSampler
checkArraySize, indexOfNonZero, of, of, of
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.DiscreteSampler
samples, samples
-
Field Details
-
sampleValue
private final int sampleValueThe sample value.
-
-
Constructor Details
-
FixedValueDiscreteSampler
FixedValueDiscreteSampler(int sampleValue) - Parameters:
sampleValue
- Sample value.
-
-
Method Details
-
sample
public int sample()Description copied from interface:DiscreteSampler
Creates anint
sample.- Returns:
- a sample.
-
withUniformRandomProvider
Description copied from class:FastLoadedDiceRollerDiscreteSampler
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<SharedStateDiscreteSampler>
- Specified by:
withUniformRandomProvider
in classFastLoadedDiceRollerDiscreteSampler
- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
toString
-