Skip to content
Prev 276478 / 398506 Next

set seed for random draws

I think it's easier than you are making it: the random seed is created
in a "pretty-random" way when you first use it and then it is updated
with each call to rDIST().

For example,

set.seed(1)
x1 <- .Random.seed
rnorm(1)
x2 <- .Random.seed
rnorm(1)
x3 <- .Random.seed

identical(x1, x2)
FALSE

identical(x1, x3)
FALSE

identical(x2, x3)
FALSE

set.seed(1)
identical(x1, .Random.seed)
TRUE

rnorm(2)
identical(x3, .Random.seed)
TRUE

But the period for the random seed to repeat is very, very long so you
don't have to think about it unless you really need to (or for
reproducible simulations)

Michael

On Sat, Nov 5, 2011 at 7:22 PM, Md Desa, Zairul Nor Deana Binti
<zndeana at ku.edu> wrote: