Skip to content
Back to formatted view

Raw Message

Message-ID: <3FFA73DE.27244.3154D8@localhost>
Date: 2004-01-06T07:37:50Z
From: PIKAL Petr
Subject: runif and sample with reproducibility
In-Reply-To: <OFF132900B.CF0F4C6E-ON41256E12.00424078@notes.edfgdf.fr>

Hallo

I think I have seen an answer to it but did not search for it.

set.seed() with sample() is perfectly reprodicble for me (well, I 
tried it only three times :-)

> set.seed(111)
> sample(1:100,10)
 [1]  8 93 38 14 23 51 86 31 75 34
> set.seed(111)
> sample(1:100,10)
 [1]  8 93 38 14 23 51 86 31 75 34
> set.seed(111)
> sample(1:100,10)
 [1]  8 93 38 14 23 51 86 31 75 34
 
I suspect you called "set seed" only once.

Cheers
Petr


On 5 Jan 2004 at 13:07, Eric ESPOSITO wrote:

> Hello,
> I already sent such an email before Christmas, but nobody answered, so
> here is my problem: I would like to sample a population but the result
> needs to be reproducible, using 'runif' or 'sample' is the good way to
> do it but I can't manage to make the results reproducible even with
> the 'set.seed' function. My aim is that th call to 'sample(1:100,10)'
> gives always the same result, how can I do that? Thanks!
> 
> Eric Esposito
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz