Class NormalDistr
java.lang.Object
org.apache.commons.math3.distribution.AbstractRealDistribution
org.apache.commons.math3.distribution.NormalDistribution
org.cloudbus.cloudsim.distributions.NormalDistr
- All Implemented Interfaces:
Serializable
,org.apache.commons.math3.distribution.RealDistribution
,ContinuousDistribution
,StatisticalDistribution
public class NormalDistr extends org.apache.commons.math3.distribution.NormalDistribution implements ContinuousDistribution
A Pseudo-Random Number Generator following the
Normal (Gaussian) distribution.
- Author:
- Manoel Campos da Silva Filho
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class org.apache.commons.math3.distribution.NormalDistribution
DEFAULT_INVERSE_ABSOLUTE_ACCURACY
Fields inherited from class org.apache.commons.math3.distribution.AbstractRealDistribution
random, randomData, SOLVER_DEFAULT_ABSOLUTE_ACCURACY
Fields inherited from interface org.cloudbus.cloudsim.distributions.ContinuousDistribution
NULL
-
Constructor Summary
Constructors Constructor Description NormalDistr(double mean, double standardDeviation)
Creates a Normal (Gaussian) Pseudo-Random Number Generator (RNG) using the current time as seed.NormalDistr(double mean, double standardDeviation, long seed)
Creates a Normal (Gaussian) Pseudo-Random Number Generator (RNG).NormalDistr(double mean, double standardDeviation, long seed, org.apache.commons.math3.random.RandomGenerator rng)
Creates a Normal (Gaussian) Pseudo-Random Number Generator (RNG). -
Method Summary
Modifier and Type Method Description 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.double
originalSample()
Generate a new pseudo random number directly from theRealDistribution.sample()
method.void
reseedRandomGenerator(long seed)
NormalDistr
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 org.apache.commons.math3.distribution.NormalDistribution
cumulativeProbability, cumulativeProbability, density, getMean, getNumericalMean, getNumericalVariance, getSolverAbsoluteAccuracy, getStandardDeviation, getSupportLowerBound, getSupportUpperBound, inverseCumulativeProbability, isSupportConnected, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive, logDensity, probability, sample
Methods inherited from class org.apache.commons.math3.distribution.AbstractRealDistribution
probability, sample
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.cloudbus.cloudsim.distributions.ContinuousDistribution
sample
Methods inherited from interface org.apache.commons.math3.distribution.RealDistribution
cumulativeProbability, cumulativeProbability, density, getNumericalMean, getNumericalVariance, getSupportLowerBound, getSupportUpperBound, inverseCumulativeProbability, isSupportConnected, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive, probability, sample
-
Constructor Details
-
NormalDistr
public NormalDistr(double mean, double standardDeviation)Creates a Normal (Gaussian) Pseudo-Random Number Generator (RNG) using the current time as seed.Internally, it relies on the
JDKRandomGenerator
, a wrapper for theRandom
class that doesn't have high-quality randomness properties but is very fast.- Parameters:
mean
- the mean for the distribution.standardDeviation
- the standard deviation for the distribution.- See Also:
NormalDistr(double, double, long, RandomGenerator)
-
NormalDistr
public NormalDistr(double mean, double standardDeviation, long seed)Creates a Normal (Gaussian) Pseudo-Random Number Generator (RNG).Internally, it relies on the
JDKRandomGenerator
, a wrapper for theRandom
class that doesn't have high-quality randomness properties but is very fast.- Parameters:
mean
- the mean for the distribution.standardDeviation
- the standard deviation for the distribution.seed
- the seed to be used.- See Also:
NormalDistr(double, double, long, RandomGenerator)
-
NormalDistr
public NormalDistr(double mean, double standardDeviation, long seed, org.apache.commons.math3.random.RandomGenerator rng)Creates a Normal (Gaussian) Pseudo-Random Number Generator (RNG).- Parameters:
mean
- the mean for the distribution.standardDeviation
- the standard deviation for the distribution.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
-
getSeed
public long getSeed()Description copied from interface:StatisticalDistribution
Gets the seed used to initialize the generator- Specified by:
getSeed
in interfaceStatisticalDistribution
- Returns:
-
reseedRandomGenerator
public void reseedRandomGenerator(long seed)- Specified by:
reseedRandomGenerator
in interfaceorg.apache.commons.math3.distribution.RealDistribution
- Overrides:
reseedRandomGenerator
in classorg.apache.commons.math3.distribution.AbstractRealDistribution
-
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 interfaceStatisticalDistribution
- Returns:
- true if the technique is applied, false otherwise
- See Also:
StatisticalDistribution.setApplyAntitheticVariates(boolean)
-
setApplyAntitheticVariates
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 interfaceStatisticalDistribution
- Parameters:
applyAntitheticVariates
- true if the technique is to be applied, false otherwise- See Also:
StatisticalDistribution.isApplyAntitheticVariates()
-
originalSample
public double originalSample()Description copied from interface:StatisticalDistribution
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
StatisticalDistribution.sample()
instead.- Specified by:
originalSample
in interfaceStatisticalDistribution
- Returns:
- the next pseudo random number in the sequence, following the
implemented distribution, ignoring the
Antithetic Variates Technique
if enabled
-