set.seed
I'm running into problems with set.seed--maybe I'm misunderstanding something. I'm running R 1.5.1 on Windows 2000. I'm basically trying to capture the random seed so that I can reproduce a simulation if it's necessary later. Using set.seed, I can certainly get reproducible results, but not the results I get on the first pass. Here's an example: # Generate a random number to initialize
runif(1)
[1] 0.965875
RNGkind()
[1] "Marsaglia-Multicarry" "Kinderman-Ramage"
# Save random seed temp.seed <- .Random.seed # Proceed to generate random uniforms runif(5)
[1] 0.18734034 0.02723140 0.46396251 0.10602243 0.64362777
# try to reproduce this sequence set.seed(temp.seed, "default") runif(5)
[1] 0.006153224 0.553233950 0.091852441 0.643058504 0.009685173
# just to see, try again set.seed(temp.seed, "default") runif(5)
[1] 0.006153224 0.553233950 0.091852441 0.643058504 0.009685173 So you can see that I can reproduce the latter sequence, but not the first sequence. As a workaround, I guess I can call set.seed prior to generating the first sequence. But it puzzles me why capturing the random seed appears not to be sufficient. Am I overlooking something? Thanks for any guidance. Jim Garrett Becton Dickinson Diagnostic Systems Baltimore, Maryland, USA -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._