[Rd] clusterSetRNGStream() question

From: J. R. M. Hosking <JRMH001_at_gmail.com>
Date: Sat, 10 Dec 2011 16:00:10 -0500


In a vanilla R 2.14.0 GUI session (on Windows XP SP3):

> library(parallel)
> cl<-makePSOCKcluster(2)
> RNGkind()

[1] "Mersenne-Twister" "Inversion"
> clusterSetRNGStream(cl)
> RNGkind()

[1] "L'Ecuyer-CMRG" "Inversion"
> stopCluster(cl)

Is it intentional that clusterSetRNGStream() changes the RNG kind in the master process? The code of clusterSetRNGStream() suggests that it is not: the old random number seed is saved in 'oldseed' and then assigned to '.Random.seed':

   .Random.seed <- oldseed

(https://svn.r-project.org/R/trunk/src/library/parallel/R/RngStream.R, line 45). However, if the intent is to restore the old seed then this assignment should be made in the global environment, e.g. via

   assign(".Random.seed", oldseed, envir = .GlobalEnv)

J. R. M. Hosking

> sessionInfo()

R version 2.14.0 (2011-10-31)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 12 Dec 2011 - 18:28:56 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 12 Dec 2011 - 20:20:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive