[R] random number generator
j.logsdon at lancaster.ac.uk
Thu Jan 20 10:58:42 CET 2000
On Thu, 20 Jan 2000, Prof Brian D Ripley wrote:
> On Wed, 19 Jan 2000, Clayton Brown wrote:
> > This question may not be specific to R, but I'm using R so here goes:
> > Since R is slow (as is Splus) I want to split a simulation and run it on
> > 2 or 3 systems at once. The simulations involve generating a large number
> > of random values. How can I set .Random.seed so that the succession of
> > random values don't overlap across systems.
> Calculation: my machine can generate about 10^5 RNG per second. Suppose you
> do something with them, so you use 10^4 per second (optimistic!) Then in
> 24 hours you will use less than 10^9. Super-Duper and Marsaglia-Multicarry
> have periods of over 10^18, so the chance of any overlap is less than
> 10^-9, and the chance of a damaging overlap are much less.
Of course this assumes that you haven't used the same RNG to 'randomise'
the seeds! You need to initialise these on different machines manually!
Fortunately .Random.seed can be written to as:
But you can change the random number generator by .Random.seed - see
?RNG for details so you could well initialise each machine using one
generator but use another generator for the main sequence. Perhaps you
could initialise them from the clock as well - this is a standard
procedure. proc.time() returns the time in seconds that have been used
but this is not very refined - is there a millisecond or finer resolution
anywhere that picks up a system clock rather than timing a procedure?
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help