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.
- Since:
- 1.5
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class FastLoadedDiceRollerDiscreteSampler
checkArraySize, indexOfNonZero, of, of, ofMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface 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:DiscreteSamplerCreates anintsample.- Returns:
- a sample.
-
withUniformRandomProvider
Description copied from class:FastLoadedDiceRollerDiscreteSamplerCreate 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<SharedStateDiscreteSampler>- Specified by:
withUniformRandomProviderin classFastLoadedDiceRollerDiscreteSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
toString
-