Class GeometricSampler.GeometricP1Sampler
- java.lang.Object
-
- org.apache.commons.rng.sampling.distribution.GeometricSampler.GeometricP1Sampler
-
- All Implemented Interfaces:
DiscreteSampler,SharedStateDiscreteSampler,SharedStateSampler<SharedStateDiscreteSampler>
- Enclosing class:
- GeometricSampler
private static final class GeometricSampler.GeometricP1Sampler extends java.lang.Object implements SharedStateDiscreteSampler
Sample from the geometric distribution when the probability of success is 1.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static GeometricSampler.GeometricP1SamplerINSTANCEThe single instance.
-
Constructor Summary
Constructors Modifier Constructor Description privateGeometricP1Sampler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intsample()Creates anintsample.java.lang.StringtoString()SharedStateDiscreteSamplerwithUniformRandomProvider(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 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 Detail
-
INSTANCE
static final GeometricSampler.GeometricP1Sampler INSTANCE
The single instance.
-
-
Method Detail
-
sample
public int sample()
Description copied from interface:DiscreteSamplerCreates anintsample.- Specified by:
samplein interfaceDiscreteSampler- Returns:
- a sample.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
withUniformRandomProvider
public SharedStateDiscreteSampler withUniformRandomProvider(UniformRandomProvider rng)
Description copied from interface:SharedStateSamplerCreate 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>- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
-