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 Modifier and Type Field Description private intsampleValueThe sample value.
-
Constructor Summary
Constructors Constructor Description FixedValueDiscreteSampler(int sampleValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intsample()Creates anintsample.java.lang.StringtoString()FastLoadedDiceRollerDiscreteSamplerwithUniformRandomProvider(UniformRandomProvider rng)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.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
-
-
-
-
Method Detail
-
sample
public int sample()
Description copied from interface:DiscreteSamplerCreates anintsample.- Returns:
- a sample.
-
withUniformRandomProvider
public FastLoadedDiceRollerDiscreteSampler withUniformRandomProvider(UniformRandomProvider rng)
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-