Description Usage Arguments Details Value See Also Examples
View source: R/RandomNumberGenerator.R
The function clusterSetRNGStream
creates a stream for
each worker/worker, and thus replicability can only be realized if each task
is assigned to the same worker on repeated runs. This is usually not
guaranteed with load-balancing parallel computations or when a long
computation is being re-started from previous partially completed
tasks/results. This implementation generates a stream for each unique tasks
(instead for each worker) and thus avoids such problems.
1 | generate_RNG_streams(N, seed = NULL, reproducible = TRUE)
|
N |
An integer. The number of streams to generate. |
seed |
An integer or |
reproducible |
A logical value. If |
The current RNG kind, if required, must be captured before this function is called because the function sets the kind to “L'Ecuyer-CMRG” (see examples).
A list of length N
containing the seed for each stream.
1 2 3 4 | RNGkind_prev <- RNGkind()
seeds <- generate_RNG_streams(10, seed = 123)
# do work with random numbers
RNGkind(kind = RNGkind_prev[1], normal.kind = RNGkind_prev[2])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.