w.huber@dkfz.de
2003-Oct-20 22:14 UTC
[Rd] Random Number Generator RNGkind() under "R CMD check" (PR#4691)
Full_Name: Wolfgang Huber Version: 1.8.0 OS: Linux Submission from: (NULL) (193.174.58.146) The man page for RNGkind says that the default is Mersenne-Twister, and when I start R interactively, I get in fact> RNGkind()[1] "Mersenne-Twister" "Inversion" However, during the execution of "R CMD check" I get> > ### ** Examples > > > > RNGkind() > [1] "Wichmann-Hill" "Inversion"This creates discrepancies between the behaviour of code that uses pseudo random numbers during "check" and otherwise.> version_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 1 minor 8.0 year 2003 month 10 day 08 language R
maechler@stat.math.ethz.ch
2003-Oct-22 11:44 UTC
[Rd] Random Number Generator RNGkind() under "R CMD check" (PR#4691)
>>>>> "WoHub" == w huber <w.huber@dkfz.de> >>>>> on Mon, 20 Oct 2003 22:15:04 +0200 (MET DST) writes:WoHub> Full_Name: Wolfgang Huber WoHub> Version: 1.8.0 WoHub> OS: Linux WoHub> Submission from: (NULL) (193.174.58.146) WoHub> The man page for RNGkind says that the default is WoHub> Mersenne-Twister, and when I start R interactively, I WoHub> get in fact >> RNGkind() WoHub> [1] "Mersenne-Twister" "Inversion" WoHub> However, during the execution of "R CMD check" I get >> > ### ** Examples >> > >> > RNGkind() >> [1] "Wichmann-Hill" "Inversion" WoHub> This creates discrepancies between the behaviour of WoHub> code that uses pseudo random numbers during "check" WoHub> and otherwise. yes, but this has been so on purpose "forever". If you really want reproducible example using random numbers you must set both RNGkind() and set.seed(). I'd agree that this should be documented -- and further, we tend to agree that we should consider changing the current behavior, probably to something like RNGkind("default","default"); set.seed(1) {in the cleanupEx() function called before each example}. But note again: You still may see "discrepancies" between the "R CMD check" and the normal usage, unless you call at least set.seed(.) yourself in your example. Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <><