mosaic (version 0.14.4)

set.rseed: 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

Run this code
# NOT RUN {
# 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)
# }

Run the code above in your browser using DataCamp Workspace