Class UniformDistr
- All Implemented Interfaces:
Serializable,org.apache.commons.math3.distribution.RealDistribution,ContinuousDistribution,StatisticalDistribution
- Since:
- CloudSim Toolkit 1.0
- Author:
- Marcos Dias de Assuncao, Manoel Campos da Silva Filho
- See Also:
-
Field Summary
Fields inherited from class org.apache.commons.math3.distribution.UniformRealDistribution
DEFAULT_INVERSE_ABSOLUTE_ACCURACYFields inherited from class org.apache.commons.math3.distribution.AbstractRealDistribution
random, randomData, SOLVER_DEFAULT_ABSOLUTE_ACCURACYFields inherited from interface org.cloudsimplus.distributions.ContinuousDistribution
NULL -
Constructor Summary
ConstructorsConstructorDescriptionCreates a uniform Pseudo-Random Number Generator (PRNG) that generates values between [0 and 1[ using the current time as seed.UniformDistr(double minInclusive, double maxExclusive) Creates a uniform Pseudo-Random Number Generator (PRNG) that produces values between a min (inclusive) and max (exclusive), using the current time as seed.UniformDistr(double minInclusive, double maxExclusive, long seed) Creates a uniform Pseudo-Random Number Generator (PRNG).UniformDistr(double minInclusive, double maxExclusive, long seed, org.apache.commons.math3.random.RandomGenerator rng) Creates a uniform Pseudo-Random Number Generator (PRNG).UniformDistr(long seed) Creates a uniform Pseudo-Random Number Generator (PRNG) that generates values between [0 and 1[ using a given seed.UniformDistr(long seed, org.apache.commons.math3.random.RandomGenerator rng) Creates a uniform Pseudo-Random Number Generator (PRNG) that generates values between [0 and 1[ using a given seed.UniformDistr(org.apache.commons.lang3.Range<Double> range) Creates a uniform Pseudo-Random Number Generator (PRNG) that produces values between a givenRange, using the current time as seed.UniformDistr(org.apache.commons.lang3.Range<Double> range, long seed) Creates a uniform Pseudo-Random Number Generator (PRNG) that produces values between a givenRange. -
Method Summary
Modifier and TypeMethodDescriptionlonggetSeed()booleanIndicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique to reduce variance of experiments using the generated numbers.doubleGenerate a new pseudo random number directly from theRealDistribution.sample()method.voidreseedRandomGenerator(long seed) 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.Methods inherited from class org.apache.commons.math3.distribution.UniformRealDistribution
cumulativeProbability, density, getNumericalMean, getNumericalVariance, getSupportLowerBound, getSupportUpperBound, inverseCumulativeProbability, isSupportConnected, isSupportLowerBoundInclusive, isSupportUpperBoundInclusiveMethods inherited from class org.apache.commons.math3.distribution.AbstractRealDistribution
cumulativeProbability, getSolverAbsoluteAccuracy, logDensity, probability, probability, sampleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.math3.distribution.RealDistribution
cumulativeProbability, cumulativeProbability, density, getNumericalMean, getNumericalVariance, getSupportLowerBound, getSupportUpperBound, inverseCumulativeProbability, isSupportConnected, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive, probability, sample
-
Constructor Details
-
UniformDistr
public UniformDistr()Creates a uniform Pseudo-Random Number Generator (PRNG) that generates values between [0 and 1[ using the current time as seed.Internally, it relies on the
JDKRandomGenerator, a wrapper for theRandomclass that doesn't have high-quality randomness properties but is very fast.- See Also:
-
UniformDistr
public UniformDistr(long seed) Creates a uniform Pseudo-Random Number Generator (PRNG) that generates values between [0 and 1[ using a given seed.Internally, it relies on the
JDKRandomGenerator, a wrapper for theRandomclass that doesn't have high-quality randomness properties but is very fast.- Parameters:
seed- the seed to initialize the Pseudo-Random Number Generator.- See Also:
-
UniformDistr
public UniformDistr(long seed, org.apache.commons.math3.random.RandomGenerator rng) Creates a uniform Pseudo-Random Number Generator (PRNG) that generates values between [0 and 1[ using a given seed.Internally, it relies on the
JDKRandomGenerator, a wrapper for theRandomclass that doesn't have high-quality randomness properties but is very fast.- Parameters:
seed- the seed already used to initialize the Pseudo-Random Number Generatorrng- the actual Pseudo-Random Number Generator that will be the base to generate random numbers following a continuous distribution.- See Also:
-
UniformDistr
Creates a uniform Pseudo-Random Number Generator (PRNG) that produces values between a givenRange, using the current time as seed.Internally, it relies on the
JDKRandomGenerator, a wrapper for theRandomclass that doesn't have high-quality randomness properties but is very fast.- Parameters:
range- theRangeto generate random values in between- See Also:
-
UniformDistr
Creates a uniform Pseudo-Random Number Generator (PRNG) that produces values between a givenRange.Internally, it relies on the
JDKRandomGenerator, a wrapper for theRandomclass that doesn't have high-quality randomness properties but is very fast.- Parameters:
range- theRangeto generate random values in betweenseed- the seed to initialize the Pseudo-Random Number Generator- See Also:
-
UniformDistr
public UniformDistr(double minInclusive, double maxExclusive) Creates a uniform Pseudo-Random Number Generator (PRNG) that produces values between a min (inclusive) and max (exclusive), using the current time as seed.Internally, it relies on the
JDKRandomGenerator, a wrapper for theRandomclass that doesn't have high-quality randomness properties but is very fast.- Parameters:
minInclusive- minimum value to generate (inclusive)maxExclusive- maximum value to generate (exclusive)- See Also:
-
UniformDistr
public UniformDistr(double minInclusive, double maxExclusive, long seed) Creates a uniform Pseudo-Random Number Generator (PRNG).Internally, it relies on the
JDKRandomGenerator, a wrapper for theRandomclass that doesn't have high-quality randomness properties but is very fast.- Parameters:
minInclusive- minimum value to generate (inclusive)maxExclusive- maximum value to generate (exclusive)seed- the seed to initialize the Pseudo-Random Number Generator.- See Also:
-
UniformDistr
public UniformDistr(double minInclusive, double maxExclusive, long seed, org.apache.commons.math3.random.RandomGenerator rng) Creates a uniform Pseudo-Random Number Generator (PRNG).- Parameters:
minInclusive- minimum value to generate (inclusive)maxExclusive- maximum value to generate (exclusive)seed- the seed already used to initialize the Pseudo-Random Number Generatorrng- 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:StatisticalDistributionGenerate 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.- Specified by:
samplein interfaceContinuousDistribution- Specified by:
samplein interfaceorg.apache.commons.math3.distribution.RealDistribution- Specified by:
samplein interfaceStatisticalDistribution- Overrides:
samplein classorg.apache.commons.math3.distribution.UniformRealDistribution- Returns:
- the next pseudo random number in the sequence, following the implemented distribution.
-
getSeed
public long getSeed()- Specified by:
getSeedin interfaceStatisticalDistribution- Returns:
- the seed used to initialize the generator
-
isApplyAntitheticVariates
public boolean isApplyAntitheticVariates()Description copied from interface:StatisticalDistributionIndicates 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.- Specified by:
isApplyAntitheticVariatesin interfaceStatisticalDistribution- Returns:
- true if the technique is applied, false otherwise
- See Also:
-
setApplyAntitheticVariates
Description copied from interface:StatisticalDistributionIndicates if the Pseudo-Random Number Generator (RNG) applies the Antithetic Variates Technique to reduce variance of experiments using the generated numbers.- Specified by:
setApplyAntitheticVariatesin interfaceStatisticalDistribution- Parameters:
applyAntitheticVariates- true if the technique is to be applied, false otherwise- See Also:
-
originalSample
public double originalSample()Description copied from interface:StatisticalDistributionGenerate 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
StatisticalDistribution.sample()instead.- Specified by:
originalSamplein interfaceStatisticalDistribution- Returns:
- the next pseudo random number in the sequence, following the
implemented distribution, ignoring the
Antithetic Variates Techniqueif enabled
-
reseedRandomGenerator
public void reseedRandomGenerator(long seed) - Specified by:
reseedRandomGeneratorin interfaceorg.apache.commons.math3.distribution.RealDistribution- Overrides:
reseedRandomGeneratorin classorg.apache.commons.math3.distribution.AbstractRealDistribution
-