Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

# 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

Project MOSAIC Statistics and Mathematics Teaching Utilities

v1.8.3
GPL (>= 2)
Authors
Randall Pruim [aut, cre], Daniel T. Kaplan [aut], Nicholas J. Horton [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.