[R] runif and sample with reproducibility

Anders Nielsen anielsen at math.ku.dk
Mon Jan 5 19:56:23 CET 2004


Hi Eric,

How about:

> set.seed(1234567)
> sample(1:100,10)
 [1] 57 72 90  3 74 46  9 81 95 78
> set.seed(1234567)
> sample(1:100,10)
 [1] 57 72 90  3 74 46  9 81 95 78
>

Cheers,

Anders.


On Mon, 5 Jan 2004, 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
>
>




More information about the R-help mailing list