From edd at debian.org  Sun May  3 01:21:01 2009
From: edd at debian.org (Dirk Eddelbuettel)
Date: Sat, 2 May 2009 18:21:01 -0500
Subject: [Rd] set.seed and /dev/random
In-Reply-To: <1e7471d50905021553s57857f87gbfcbdabedc006b79@mail.gmail.com>
References: <1e7471d50905021553s57857f87gbfcbdabedc006b79@mail.gmail.com>
Message-ID: <18940.54621.1986.309356@ron.nulle.part>


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.



[Rd] set.seed and /dev/random
Dirk Eddelbuettel