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 defaultSeed()  
    long getSeed()
    Gets the seed used to initialize the generator
    boolean isApplyAntitheticVariates()
    Indicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique in order 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 ContinuousDistribution.
    double originalSample()
    Generate a new pseudo random number directly from the RealDistribution.sample() method.
    default double sample()
    Generate a new pseudo random number.
    StatisticalDistribution setApplyAntitheticVariates​(boolean applyAntitheticVariates)
    Indicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique in order 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 or generated random numbers. Check the provided link for details.
      Returns:
      the next pseudo random number in the sequence, following the implemented distribution.
    • getSeed

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

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

      Well19937c is the PRNG used by RealDistribution implementations of the org.apache.commons.math3. Classes in such a library are used internally by ContinuousDistribution implementations to provide PRNGs following some statistical distributions.

      Despite the classes from org.apache.commons.math3 use the same RandomGenerator defined here, providing a RandomGenerator when instantiate a ContinuousDistribution allow 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 difficult 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 in order 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 to it work, one 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 the developer 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 that return 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(boolean)
    • setApplyAntitheticVariates

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