Class DynamicCreator

  • All Implemented Interfaces:
    Iterable<RandomLongGenerator>

    public class DynamicCreator
    extends Object
    implements Iterable<RandomLongGenerator>
    Performs the Dynamic Creation algorithm (DC) to generate parameters for 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.

    See Also:
    • 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 the 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.

        Parameters:
        p - the value of p
        seeds - a seed for the RNG that controls the randomized nature of the dynamic creation algorithm