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 int
sampleValue
The sample value.
-
Constructor Summary
Constructors Constructor Description FixedValueDiscreteSampler(int sampleValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
sample()
Creates anint
sample.java.lang.String
toString()
FastLoadedDiceRollerDiscreteSampler
withUniformRandomProvider(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:DiscreteSampler
Creates anint
sample.- Returns:
- a sample.
-
withUniformRandomProvider
public FastLoadedDiceRollerDiscreteSampler withUniformRandomProvider(UniformRandomProvider rng)
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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-