[Rd] Random Number Generator RNGkind() under "R CMD check" (PR#4691)

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Wed Oct 22 11:45:31 MEST 2003

>>>>> "WoHub" == w huber <w.huber at 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) (

    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 at 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			<><

More information about the R-devel mailing list