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?). 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? I must admit I have very little idea about RNGs, so my question is possibly very naive. Thank you Saptarshi
set.seed and /dev/random
4 messages · Dirk Eddelbuettel, Saptarshi Guha, Thomas Lumley
On 2 May 2009 at 18:53, 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?). | | 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? Some folks do. But do read the fine print about entropy etc. An alternnative is provided by the random package on CRAN (slightly re-indented below). Dirk R> library(help=random) Information on package 'random' Description: Package: random Version: 0.2.0 Date: $Date: 2009-01-03 11:45:17 -0600 (Sat, 03 Jan 2009) $ Author: Dirk Eddelbuettel <edd at debian.org> Maintainer: Dirk Eddelbuettel <edd at debian.org> Title: True random numbers using random.org Description: This package provides an interface to the true random number service provided by the random.org website created by Mads Haahr. The random.org web service samples atmospheric noise via radio tuned to an unused broadcasting frequency together with a skew correction algorithm due to John von Neumann. More background is available in the included vignette based on an essay by Mads Haahr. In its current form, the package offers functions to retrieve random integers, randomized sequences and random strings. Depends: R (>= 2.8.0) License: GPL Version 2 URL: http://www.random.org Built: R 2.8.1; ; 2009-01-03 11:46:25; unix Index: random True random numbers from random.org Further information is available in the following vignettes in directory '/usr/local/lib/R/site-library/random/doc': random-essay: random.org: Introduction to Randomness and Random Numbers (source, pdf) random-intro: random: An R package for true random numbers (source, pdf) R> | Would it be a portability issue? | I must admit I have very little idea about RNGs, so my question is | possibly very naive. | | Thank you | Saptarshi | | ______________________________________________ | R-devel at r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-devel
Three out of two people have difficulties with fractions.
Interesting stuff. Thank you Saptarshi
On Sat, May 2, 2009 at 7:21 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
On 2 May 2009 at 18:53, 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?). | | 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? Some folks do. But do read the fine print about entropy etc. An alternnative is provided by the random package on CRAN (slightly re-indented below). Dirk R> library(help=random) ? ? ? ? ? ? ? ?Information on package 'random' Description: Package: ? ? ? random Version: ? ? ? 0.2.0 Date: ? ? ? ? ?$Date: 2009-01-03 11:45:17 -0600 (Sat, 03 Jan 2009) $ Author: ? ? ? ?Dirk Eddelbuettel <edd at debian.org> Maintainer: ? ?Dirk Eddelbuettel <edd at debian.org> Title: ? ? ? ? True random numbers using random.org Description: ? This package provides an interface to the true random number ? ? ? ? ? ? ? service provided by the random.org website created by Mads ? ? ? ? ? ? ? Haahr. ?The random.org web service samples atmospheric noise ? ? ? ? ? ? ? via radio tuned to an unused broadcasting frequency together ? ? ? ? ? ? ? with a skew correction algorithm due to John von Neumann. ? ? ? ? ? ? ? More background is available in the included vignette based on ? ? ? ? ? ? ? an essay by Mads Haahr. In its current form, the package ? ? ? ? ? ? ? offers functions to retrieve random integers, randomized ? ? ? ? ? ? ? sequences and random strings. Depends: ? ? ? R (>= 2.8.0) License: ? ? ? GPL Version 2 URL: ? ? ? ? ? http://www.random.org Built: ? ? ? ? R 2.8.1; ; 2009-01-03 11:46:25; unix Index: random ? ? ? ? ? ? ? ? ?True random numbers from random.org Further information is available in the following vignettes in directory '/usr/local/lib/R/site-library/random/doc': random-essay: random.org: Introduction to Randomness and Random Numbers (source, pdf) random-intro: random: An R package for true random numbers (source, pdf) R> | Would it be a portability issue? | I must admit I have very little idea about RNGs, so my question is | possibly very naive. | | Thank you | Saptarshi | | ______________________________________________ | R-devel at r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-devel -- Three out of two people have difficulties with fractions.
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