Interface StatisticalDistribution

All Known Subinterfaces:
ContinuousDistribution, DiscreteDistribution
All Known Implementing Classes:
ExponentialDistr, GammaDistr, LogNormalDistr, LomaxDistr, NormalDistr, ParetoDistr, PoissonDistr, UniformDistr, WeibullDistr, ZipfDistr

public interface StatisticalDistribution
Interface to be implemented by a Pseudo-Random Number Generator (PRNG) that follows some statistical distribution, even discrete or continuous.
Since:
CloudSim Plus 5.5.1
Author:
Manoel Campos da Silva Filho
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
     
    long
     
    boolean
    Indicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique to reduce variance of experiments using the generated numbers.
    static org.apache.commons.math3.random.RandomGenerator
    newDefaultGen(long seed)
    Instantiates a Well19937c as the default Pseudo-Random Number Generator (PRNG) used by implementing classes.
    double
    Generate a new pseudo random number directly from the RealDistribution.sample() method.
    default double
    Generate a new pseudo random number.
    setApplyAntitheticVariates(boolean applyAntitheticVariates)
    Indicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique to reduce variance of experiments using the generated numbers.
  • Method Details

    • originalSample

      double originalSample()
      Generate a new pseudo random number directly from the RealDistribution.sample() method. This way, the Antithetic Variates Technique is ignored if enabled.

      Usually you shouldn't call this method but sample() instead.

      Returns:
      the next pseudo random number in the sequence, following the implemented distribution, ignoring the Antithetic Variates Technique if enabled
    • sample

      default double sample()
      Generate a new pseudo random number. If the Antithetic Variates Technique is enabled, the returned value is manipulated to try reducing variance of generated random numbers. Check link above for details.
      Returns:
      the next pseudo random number in the sequence, following the implemented distribution.
    • getSeed

      long getSeed()
      Returns:
      the seed used to initialize the generator
    • newDefaultGen

      static org.apache.commons.math3.random.RandomGenerator newDefaultGen(long seed)
      Instantiates a Well19937c as the default Pseudo-Random Number Generator (PRNG) used by implementing classes.

      Well19937c is the PRNG also used by RealDistribution implementations of the

      invalid reference
      org.apache.commons.math3
      . ContinuousDistribution implementations rely on classes in such a library to provide PRNGs following some statistical distributions.

      Despite the classes from

      invalid reference
      org.apache.commons.math3
      use the same RandomGenerator defined here, providing a RandomGenerator when instantiating a ContinuousDistribution allows the researcher to define any PRNG by calling the appropriate ContinuousDistribution constructor. For instance, the UniformDistr(long, RandomGenerator) constructor enables providing a different PRNG, while the UniformDistr(long) uses the PRNG instantiated here.

      By calling a constructor that accepts a RandomGenerator, the researcher may provide a different PRNG with either higher performance or better statistical properties (it's challenging to have both properties on the same PRNG).

      Parameters:
      seed - the seed to set
    • defaultSeed

      static long defaultSeed()
    • isApplyAntitheticVariates

      boolean isApplyAntitheticVariates()
      Indicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique to reduce variance of experiments using the generated numbers.

      This technique doesn't work for all the cases. However, in the cases it can be applied, in order for it to work, you have to perform some actions. Consider an experiment that has to run "n" times. The first half of these experiments has to use the seeds you want. However, the second half of the experiments have to set the applyAntitheticVariates attribute to true and use the seeds of the first half of experiments.

      Thus, the first half of experiments are run using PRNGs, returning random numbers as U(0, 1)[seed_1], ..., U(0, 1)[seed_n]. The second half of experiments then uses the seeds of the first half of experiments, returning random numbers as 1 - U(0, 1)[seed_1], ..., 1 - U(0, 1)[seed_n].
      Returns:
      true if the technique is applied, false otherwise
      See Also:
    • setApplyAntitheticVariates

      StatisticalDistribution setApplyAntitheticVariates(boolean applyAntitheticVariates)
      Indicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique to reduce variance of experiments using the generated numbers.
      Parameters:
      applyAntitheticVariates - true if the technique is to be applied, false otherwise
      See Also: