Class ZipfDistr

java.lang.Object
org.cloudbus.cloudsim.distributions.ZipfDistr
All Implemented Interfaces:
DiscreteDistribution, StatisticalDistribution

public class ZipfDistr extends Object implements DiscreteDistribution
A Pseudo-Random Number Generator following the Zipf distribution.
Since:
CloudSim Toolkit 1.0
Author:
Marcos Dias de Assuncao, Manoel Campos da Silva Filho
  • Constructor Summary

    Constructors
    Constructor
    Description
    ZipfDistr(double shape, int population)
    Creates a Zipf Pseudo-Random Number Generator (PRNG).
    ZipfDistr(double shape, int population, long seed)
    Creates a Zipf Pseudo-Random Number Generator (PRNG).
    ZipfDistr(double shape, int population, long seed, org.apache.commons.math3.random.RandomGenerator rng)
    Creates a Zipf Pseudo-Random Number Generator (PRNG).
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Gets the seed used to initialize the generator
    boolean
    Indicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique in order to reduce variance of experiments using the generated numbers.
    double
    Generate a new pseudo random number directly from the RealDistribution.sample() method.
    double
    Generate a new pseudo random number.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ZipfDistr

      public ZipfDistr(double shape, int population)
      Creates a Zipf Pseudo-Random Number Generator (PRNG).
      Parameters:
      shape - the shape distribution parameter
      population - the population distribution parameter
      See Also:
    • ZipfDistr

      public ZipfDistr(double shape, int population, long seed)
      Creates a Zipf Pseudo-Random Number Generator (PRNG).
      Parameters:
      shape - the shape distribution parameter
      population - the population distribution parameter
      seed - the seed
      See Also:
    • ZipfDistr

      public ZipfDistr(double shape, int population, long seed, org.apache.commons.math3.random.RandomGenerator rng)
      Creates a Zipf Pseudo-Random Number Generator (PRNG).
      Parameters:
      shape - the shape distribution parameter
      population - the population distribution parameter
      seed - the seed already used to initialize the Pseudo-Random Number Generator
      rng - the actual Pseudo-Random Number Generator that will be the base to generate random numbers following a continuous distribution.
  • Method Details

    • sample

      public double sample()
      Description copied from interface: StatisticalDistribution
      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.
      Specified by:
      sample in interface StatisticalDistribution
      Returns:
      the next pseudo random number in the sequence, following the implemented distribution.
    • getSeed

      public long getSeed()
      Description copied from interface: StatisticalDistribution
      Gets the seed used to initialize the generator
      Specified by:
      getSeed in interface StatisticalDistribution
      Returns:
    • isApplyAntitheticVariates

      public boolean isApplyAntitheticVariates()
      Description copied from interface: StatisticalDistribution
      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].
      Specified by:
      isApplyAntitheticVariates in interface StatisticalDistribution
      Returns:
      true if the technique is applied, false otherwise
      See Also:
    • setApplyAntitheticVariates

      public ZipfDistr setApplyAntitheticVariates(boolean applyAntitheticVariates)
      Description copied from interface: StatisticalDistribution
      Indicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique in order to reduce variance of experiments using the generated numbers.
      Specified by:
      setApplyAntitheticVariates in interface StatisticalDistribution
      Parameters:
      applyAntitheticVariates - true if the technique is to be applied, false otherwise
      See Also:
    • originalSample

      public double originalSample()
      Description copied from interface: StatisticalDistribution
      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 StatisticalDistribution.sample() instead.

      Specified by:
      originalSample in interface StatisticalDistribution
      Returns:
      the next pseudo random number in the sequence, following the implemented distribution, ignoring the Antithetic Variates Technique if enabled