Class ProbabilityMassSampler<X>

  • Type Parameters:
    X - the type of the random variable
    All Implemented Interfaces:
    Seedable

    public class ProbabilityMassSampler<X>
    extends Object
    implements Seedable
    A random sampler that is constructed ad-hoc from a list of values and their probabilities.
    • Constructor Detail

      • 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 probabilities
        uniformRNG - a uniform random number generator
    • Method Detail

      • seed

        public void seed​(long... seeds)
        Description copied from interface: Seedable
        Seed the random number/vector/scenario generator to produce repeatable experiments.
        Specified by:
        seed in interface Seedable
        Parameters:
        seeds - the seeds
      • next

        public X next()
        Gets the next random element from the range of the probability distribution.
        Returns:
        the next random outcome