From tlumley at u.washington.edu  Sun May  3 21:46:26 2009
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Sun, 3 May 2009 12:46:26 -0700 (PDT)
Subject: [Rd] set.seed and /dev/random
In-Reply-To: <1e7471d50905021553s57857f87gbfcbdabedc006b79@mail.gmail.com>
Message-ID: <Pine.LNX.4.43.0905031246260.28507@hymn14.u.washington.edu>

On Sat, 2 May 2009, Saptarshi Guha wrote:

> Hello,
> In ?set.seed I notice that a seed is created from the system time.
> Thus if two machines were (hypothetically) running for the same time
> and R was started simultaneously on both, the would have the same
> seeds (correct?).

Yes. This could in principle be a problem for clusters, though that level of synchronization is unlikely.

> I assume reading from /dev/random would be different for both of these
> machines, so my question is why not use an integer read from
> /dev/random to create the seed?
>
> Would it be a portability issue?

Yes. Most R users probably don't have /dev/random

    -thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle



[Rd] set.seed and /dev/random
Thomas Lumley