Interface StatisticalDistribution
- All Known Subinterfaces:
ContinuousDistribution
,DiscreteDistribution
- All Known Implementing Classes:
ExponentialDistr
,GammaDistr
,LognormalDistr
,LomaxDistr
,NormalDistr
,ParetoDistr
,PoissonDistr
,UniformDistr
,WeibullDistr
,ZipfDistr
public interface StatisticalDistribution
- 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 generatorboolean
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 aWell19937c
as the defaultPseudo-Random Number Generator
(PRNG) used byContinuousDistribution
.double
originalSample()
Generate a new pseudo random number directly from theRealDistribution.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 theRealDistribution.sample()
method. This way, theAntithetic 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 theAntithetic 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 aWell19937c
as the defaultPseudo-Random Number Generator
(PRNG) used byContinuousDistribution
.Well19937c
is the PRNG used byRealDistribution
implementations of theorg.apache.commons.math3
. Classes in such a library are used internally byContinuousDistribution
implementations to provide PRNGs following some statistical distributions.Despite the classes from
org.apache.commons.math3
use the sameRandomGenerator
defined here, providing aRandomGenerator
when instantiate aContinuousDistribution
allow the researcher to define any PRNG by calling the appropriateContinuousDistribution
constructor. 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 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
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()
-