View source: R/make_rng_seeds.R
| make_rng_seeds | R Documentation |
Produce Reproducible Seeds for Parallel Random Number Generation
make_rng_seeds(count, seed = FALSE)
count |
The number of RNG seeds to produce. |
seed |
A logical specifying whether RNG seeds should be generated
or not. ( |
This function generates count independent
L'Ecuyer-CMRG random seeds that can be used as
.Random.seed for parallel processing. These seeds are produced with
help of parallel::nextRNGSubStream() and
parallel::nextRNGStream() using a strategy that
seed <- <initial RNG seed>
for (ii in seq_len(count)) {
seeds[[ii]] <- parallel::nextRNGSubStream(seed)
seed <- parallel::nextRNGStream(seed)
}
This function forwards the RNG state 1 + count times if seed = TRUE.
Returns a non-named list of count independent
L'Ecuyer-CMRG random seeds.
If seed is NULL or FALSE, then NULL is returned.
## Set up L'Ecuyer-CMRG random seeds for 100 parallel tasks
## based on .Random.seed in the current R process
seeds <- make_rng_seeds(100L, seed = TRUE)
str(seeds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.