Interface StatisticalDistribution
- All Known Subinterfaces:
ContinuousDistribution,DiscreteDistribution
- All Known Implementing Classes:
ExponentialDistr,GammaDistr,LogNormalDistr,LomaxDistr,NormalDistr,ParetoDistr,PoissonDistr,UniformDistr,WeibullDistr,ZipfDistr
- Since:
- CloudSim Plus 5.5.1
- Author:
- Manoel Campos da Silva Filho
-
Method Summary
Modifier and TypeMethodDescriptionstatic longlonggetSeed()booleanIndicates 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.RandomGeneratornewDefaultGen(long seed) Instantiates aWell19937cas the defaultPseudo-Random Number Generator(PRNG) used by implementing classes.doubleGenerate a new pseudo random number directly from theRealDistribution.sample()method.default doublesample()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 theRealDistribution.sample()method. This way, theAntithetic Variates Techniqueis 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 Techniqueif enabled
-
sample
default double sample()Generate a new pseudo random number. If theAntithetic Variates Techniqueis 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 aWell19937cas the defaultPseudo-Random Number Generator(PRNG) used by implementing classes.Well19937cis the PRNG also used byRealDistributionimplementations of the.invalid reference
org.apache.commons.math3ContinuousDistributionimplementations rely on classes in such a library to provide PRNGs following some statistical distributions.Despite the classes from
use the sameinvalid reference
org.apache.commons.math3RandomGeneratordefined here, providing aRandomGeneratorwhen instantiating aContinuousDistributionallows the researcher to define any PRNG by calling the appropriateContinuousDistributionconstructor. For instance, theUniformDistr(long, RandomGenerator)constructor enables providing a different PRNG, while theUniformDistr(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
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].applyAntitheticVariatesattribute totrueand use the seeds of the first half of experiments.- Returns:
- true if the technique is applied, false otherwise
- See Also:
-
setApplyAntitheticVariates
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:
-