Re: [R] R: simulation

From: Petr Pikal <petr.pikal_at_precheza.cz>
Date: Fri 04 Mar 2005 - 23:26:53 EST

On 4 Mar 2005 at 13:07, Clark Allan wrote:

> hi all
>
> a simple question
>
> i want to run simulations in r. i however want the experiments to be
> repeated at a later time with exactly the same numbers by other users.
> can i set the random number seed for rnorm in some way?

See ?set.seed
It is called once before rnorm generator

> set.seed(1)
> rnorm(10)
 [1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 - 0.8204684 0.4874291 0.7383247 0.5757814 -0.3053884

> set.seed(10)
> rnorm(10)

 [1] 0.01874617 -0.18425254 -1.37133055 -0.59916772 0.29454513 0.38979430 -1.20807618 -0.36367602 -1.62667268 -0.25647839

> set.seed(1)
> rnorm(10)
 [1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 - 0.8204684 0.4874291 0.7383247 0.5757814 -0.3053884
>

Cheers.
Petr

>
> e.g. is there some arguement that goes with rnorm?
>
> please supply an example
>
> regards
> Allan

Petr Pikal
petr.pikal@precheza.cz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Mar 05 01:10:56 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:40 EST