public class DynamicCreator extends Object implements Iterable<RandomLongGenerator>
MersenneTwister
.
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 and Description |
---|
DynamicCreator(MersenneExponent p,
long... seeds)
Constructs a new instance which aims to generate MT RNGs with the given period.
|
Modifier and Type | Method and Description |
---|---|
Iterator<RandomLongGenerator> |
iterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public DynamicCreator(MersenneExponent p, long... seeds)
MersenneExponent
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.p
- the value of pseeds
- a seed for the RNG that controls the randomized nature of the dynamic creation
algorithmpublic Iterator<RandomLongGenerator> iterator()
iterator
in interface Iterable<RandomLongGenerator>
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.