Hello

When loading a package, I'm wondering if it's frowned upon for the package to alter the state of the random number generator? I guess not, since the parallel package does it?

   > set.seed(6860)
   > old.seed <- .GlobalEnv$.Random.seed
   > library(parallel)
   > new.seed <- .GlobalEnv$.Random.seed
   > identical(old.seed, new.seed)
   [1] FALSE

I ask because, I found myself writing a custom wrapper around library() to restore the original RNG state, in order to increase reproducibility. But now wondering if others would welcome such a feature to be added to base R? Either something very general like

   preserveRNGstate(library(parallel))

or perhaps an specific enhancement to library itself?

Regards
Ben

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to