Class DynamicCreator
- java.lang.Object
-
- dev.nm.stat.random.rng.univariate.uniform.mersennetwister.dynamiccreation.DynamicCreator
-
- All Implemented Interfaces:
Iterable<RandomLongGenerator>
public class DynamicCreator extends Object implements Iterable<RandomLongGenerator>
Performs the Dynamic Creation algorithm (DC) to generate parameters forMersenneTwister
. The algorithm, developed by the original authors of Mersenne-Twister, can generate up to 216 sets of parameters, which are orthogonal in that the streams of random numbers are uncorrelated with each other. For example, if you want 100 independent random streams in 100 parallel machines, then what you need to do is calling DC 100 times, with id numbers 0 to 99. Then DC returns 100 different parameters for generators. Now you have 100 independent sources. Iterators returned by this class are thread safe.
-
-
Constructor Summary
Constructors Constructor Description DynamicCreator(MersenneExponent p, long... seeds)
Constructs a new instance which aims to generate MT RNGs with the given period.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<RandomLongGenerator>
iterator()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
DynamicCreator
public DynamicCreator(MersenneExponent p, long... seeds)
Constructs a new instance which aims to generate MT RNGs with the given period. The period of the RNG will be 2p, where p is theMersenneExponent
provided. Note that choosing a greater period rapidly increases the cost of running the algorithm and the smallest period should suffice for all but the most demanding application.- Parameters:
p
- the value of pseeds
- a seed for the RNG that controls the randomized nature of the dynamic creation algorithm
-
-
Method Detail
-
iterator
public Iterator<RandomLongGenerator> iterator()
- Specified by:
iterator
in interfaceIterable<RandomLongGenerator>
-
-