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 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.GeometricP1Sampler
INSTANCE
The single instance.
-
Constructor Summary
Constructors Modifier Constructor Description private
GeometricP1Sampler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
sample()
Creates anint
sample.java.lang.String
toString()
SharedStateDiscreteSampler
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 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:DiscreteSampler
Creates anint
sample.- Specified by:
sample
in interfaceDiscreteSampler
- Returns:
- a sample.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
withUniformRandomProvider
public SharedStateDiscreteSampler withUniformRandomProvider(UniformRandomProvider rng)
Description copied from interface:SharedStateSampler
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>
- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
-