Class UniformDistr
- java.lang.Object
-
- org.cloudbus.cloudsim.distributions.ContinuousDistributionAbstract
-
- org.cloudbus.cloudsim.distributions.UniformDistr
-
- All Implemented Interfaces:
ContinuousDistribution
public class UniformDistr extends ContinuousDistributionAbstract
A pseudo random number generator following the Uniform continuous distribution.- Since:
- CloudSim Toolkit 1.0
- Author:
- Marcos Dias de Assuncao
-
-
Field Summary
-
Fields inherited from interface org.cloudbus.cloudsim.distributions.ContinuousDistribution
NULL
-
-
Constructor Summary
Constructors Constructor Description UniformDistr()
Creates new uniform pseudo random number generator that generates values between [0 and 1[ using the current time as seed.UniformDistr(double min, double max)
Creates new uniform pseudo random number generator that produces values between a min (inclusive) and max (exclusive).UniformDistr(double min, double max, long seed)
Creates new uniform pseudo random number generator.UniformDistr(long seed)
Creates new uniform pseudo random number generator that generates values between [0 and 1[ using a given seed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isApplyAntitheticVariates()
Indicates if the pseudo random number generator (PRNG) has to apply the Antithetic Variates Technique in order to reduce variance of experiments using this PRNG.double
sample()
Generate a new pseudo random number.static double
sample(Random rd, double min, double max)
Generates a new pseudo random number based on the generator and values provided as parameters.UniformDistr
setApplyAntitheticVariates(boolean applyAntitheticVariates)
Defines if the pseudo random number generator (PRNG) has to apply the Antithetic Variates Technique in order to reduce variance of experiments using this PRNG.-
Methods inherited from class org.cloudbus.cloudsim.distributions.ContinuousDistributionAbstract
getSeed, setSeed
-
-
-
-
Constructor Detail
-
UniformDistr
public UniformDistr()
Creates new uniform pseudo random number generator that generates values between [0 and 1[ using the current time as seed.
-
UniformDistr
public UniformDistr(long seed)
Creates new uniform pseudo random number generator that generates values between [0 and 1[ using a given seed.- Parameters:
seed
- simulation seed to be used
-
UniformDistr
public UniformDistr(double min, double max)
Creates new uniform pseudo random number generator that produces values between a min (inclusive) and max (exclusive).- Parameters:
min
- minimum value (inclusive)max
- maximum value (exclusive)
-
UniformDistr
public UniformDistr(double min, double max, long seed)
Creates new uniform pseudo random number generator.- Parameters:
min
- minimum value (inclusive)max
- maximum value (exclusive)seed
- simulation seed to be used
-
-
Method Detail
-
sample
public double sample()
Description copied from interface:ContinuousDistribution
Generate a new pseudo random number.- Specified by:
sample
in interfaceContinuousDistribution
- Overrides:
sample
in classContinuousDistributionAbstract
- Returns:
- the next pseudo random number in the sequence, following the implemented distribution.
-
sample
public static double sample(Random rd, double min, double max)
Generates a new pseudo random number based on the generator and values provided as parameters.- Parameters:
rd
- the random number generatormin
- the minimum valuemax
- the maximum value- Returns:
- the next random number in the sequence
-
isApplyAntitheticVariates
public boolean isApplyAntitheticVariates()
Indicates if the pseudo random number generator (PRNG) has to apply the Antithetic Variates Technique in order to reduce variance of experiments using this PRNG. 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 has to be applied, false otherwise
-
setApplyAntitheticVariates
public UniformDistr setApplyAntitheticVariates(boolean applyAntitheticVariates)
Defines if the pseudo random number generator (PRNG) has to apply the Antithetic Variates Technique in order to reduce variance of experiments using this PRNG.- Parameters:
applyAntitheticVariates
- true if the technique has to be applied, false otherwise- See Also:
isApplyAntitheticVariates()
-
-