clusterSetRNGStream(cl = NULL, iseed = NULL) nextRNGStream(seed) nextRNGSubStream(seed)
cl | a cluster object. Usually generated by makeCluster. If not provided, the default cluster is used. |
iseed | an integer value. Used to generate a new seed for the "L'Ecuyer-CMRG" random number generator. If not provided, a random seed is selected. |
seed | a seed suitable for the "L'Ecuyer-CMRG" random number generator. |
clusterSetRNGStream derives the first node's "L'Ecuyer-CMRG" seed from the iseed value, or a random value if this is not given. The second node seed is computed from nextRNGStream(firstNodeSeed), the third node seed is nextRNGStream(secondNodeSeed), and so on.
This random number generator was designed to allow quickly skipping ahead a large number of random numbers, providing access to a new independent section within the random number sequence. nextRNGStream produces the seed that would be produced after generating 2^127 random numbers. nextRNGSubStream produces the seed that would be produced after generating 2^76 random numbers. The technique for generating random number streams and substreams is described in the reference LEcuyer (2002), Operations Research.
clusterSetRNGStream | returns NULL invisibly. |
nextRNGStream | returns a length-7 integer vector suitable for the "L'Ecuyer-CMRG" random number generator. |
nextRNGSubStream | returns a length-7 integer vector suitable for the "L'Ecuyer-CMRG" random number generator. |
RNGkind("L'Ecuyer-CMRG") runif(1) .Random.seed nextRNGStream(.Random.seed) nextRNGSubStream(.Random.seed)## Not run: cl <- makeCluster(2) clusterSetRNGStream(cl, iseed = 123) # do some other parallel works on clusters stopCluster(cl) ## End(Not run)