Description Usage Arguments Details Value Examples
The function parallel::clusterSetRNGStream
creates a stream for each slave/core, and thus replicability can only realized if each task is assigned to a the same slave at each repeated call. This is usually not guaranteed with load-balancing parallel computations or when a long computation is being re-started continuing on previously produced results.
This implementation generates a stream for each unique tasks and thus avoids those two problems.
1 | prepare_RNG_streams(N, iseed = NULL)
|
N |
An integer. The number of streams to generate. |
iseed |
An integer or |
The current RNG kind, if required, must be captures before calling this function because the function sets it to "L'Ecuyer-CMRG" (see examples).
A vector of length N containing the seed for each stream.
1 2 3 4 | RNGkind_old <- RNGkind()
seeds <- prepare_RNG_streams(10, iseed = 123)
# do work with random numbers
RNGkind(kind = RNGkind_old[1], normal.kind = RNGkind_old[2])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.