Class JDKThreadLocalRandomGenerator
- All Implemented Interfaces:
org.apache.commons.math3.random.RandomGenerator
RandomGenerator that internally uses the ThreadLocalRandom,
a very fast Pseudo-Random Number Generator (PRNG)
with higher performance than Random, mainly in concurrent environments.
The ThreadLocalRandom also has
much better performance than PRNGs available in
invalid reference
org.apache.commons.math3
This generator has some drawbacks.
It only generates the seed internally and doesn't allow setting an explicit seed.
Calling the setSeed() methods will throw an UnsupportedOperationException
and there is no way to get the generated seed.
This latter issue makes it impossible to reproduce a
simulation experiment to verify the generated results if the seed is unknown.
Finally, it doesn't allow applying the
Antithetic Variates Technique
to try reducing the variance of experiments using the generated numbers.
Classes such as UniformDistr provide such a feature if the
underlying PRNG allows setting a seed.
That is explained because the technique is applied when multiple runs of the same simulation
are executed.
In such a scenario, the second half of experiments have to use the seeds from the first half.
- Since:
- CloudSim Plus 4.3.9
- Author:
- Manoel Campos da Silva Filho
-
Method Details
-
setSeed
public void setSeed(int seed) - Specified by:
setSeedin interfaceorg.apache.commons.math3.random.RandomGenerator
-
setSeed
public void setSeed(int[] seed) - Specified by:
setSeedin interfaceorg.apache.commons.math3.random.RandomGenerator
-
setSeed
public void setSeed(long seed) - Specified by:
setSeedin interfaceorg.apache.commons.math3.random.RandomGenerator
-
nextBytes
public void nextBytes(byte[] bytes) - Specified by:
nextBytesin interfaceorg.apache.commons.math3.random.RandomGenerator
-
nextInt
public int nextInt()- Specified by:
nextIntin interfaceorg.apache.commons.math3.random.RandomGenerator
-
nextInt
public int nextInt(int bound) - Specified by:
nextIntin interfaceorg.apache.commons.math3.random.RandomGenerator
-
nextLong
public long nextLong()- Specified by:
nextLongin interfaceorg.apache.commons.math3.random.RandomGenerator
-
nextBoolean
public boolean nextBoolean()- Specified by:
nextBooleanin interfaceorg.apache.commons.math3.random.RandomGenerator
-
nextFloat
public float nextFloat()- Specified by:
nextFloatin interfaceorg.apache.commons.math3.random.RandomGenerator
-
nextDouble
public double nextDouble()- Specified by:
nextDoublein interfaceorg.apache.commons.math3.random.RandomGenerator
-
nextGaussian
public double nextGaussian()- Specified by:
nextGaussianin interfaceorg.apache.commons.math3.random.RandomGenerator
-