[R] Static random numbers

Marc Schwartz marc_schwartz at comcast.net
Thu Dec 4 01:29:27 CET 2008


on 12/03/2008 06:10 PM Bastian Offermann wrote:
> Hello,
> 
> can anybody help me out saving random numbers? What I am doing is to
> generate a series of random numbers and keep it as a zoo object.
> 
> z <- 1000
> 
> rn1 <- as.zoo(rnorm(z))
> 
> The random numbers will be analyzed and described in a LaTeX document,
> so I have to keep them static somehow. The fact that they are kept
> as a zoo object should not be of too much concern here. Thanks in advance.
> 
> Regards
> 
> Bastian Offermann

See ?set.seed, which will allow you to specify the seed for the RNG, so
that you can reproduce the same sequence again in the future:

  set.seed(1)
  rn1 <- as.zoo(rnorm(1000))

HTH,

Marc Schwartz




More information about the R-help mailing list