set.rseed: Set seed in parallel compatible way

View source: R/do.R

set.rseedR Documentation

Set seed in parallel compatible way

Description

When the parallel package is used, setting the RNG seed for reproducibility involves more than simply calling set.seed(). set.rseed takes care of the additional overhead.

Usage

set.rseed(seed)

Arguments

seed

seed for the random number generator

Details

If the parallel package is not on the search path, then set.seed() is called. If parallel is on the search path, then the RNG kind is set to "L'Ecuyer-CMRG", the seed is set and mc.reset.stream is called.

Examples

# These should give identical results, even if the `parallel' package is loaded.
set.rseed(123); do(3) * resample(1:10, 2)
set.rseed(123); do(3) * resample(1:10, 2)

mosaic documentation built on May 29, 2024, 5:27 a.m.