Class ProbabilityMassSampler<X>
java.lang.Object
dev.nm.stat.distribution.discrete.ProbabilityMassSampler<X>
- Type Parameters:
X
- the type of the random variable
- All Implemented Interfaces:
Seedable
A random sampler that is constructed ad-hoc from a list of values and their probabilities.
-
Constructor Summary
ConstructorsConstructorDescriptionProbabilityMassSampler
(List<ProbabilityMassFunction.Mass<X>> outcomes, RandomLongGenerator uniformRNG) Creates an instance with the probable values and an RNG. -
Method Summary
-
Constructor Details
-
ProbabilityMassSampler
public ProbabilityMassSampler(List<ProbabilityMassFunction.Mass<X>> outcomes, RandomLongGenerator uniformRNG) Creates an instance with the probable values and an RNG.- Parameters:
outcomes
- the values this distribution can take and their associated probabilitiesuniformRNG
- a uniform random number generator
-
-
Method Details
-
seed
public void seed(long... seeds) Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments. -
next
Gets the next random element from the range of the probability distribution.- Returns:
- the next random outcome
-