[R] random number generator: same seed used in different sessions
Jason Liao
jg_liao at yahoo.com
Wed Jun 15 18:19:14 CEST 2005
I did several simulation sessions and the result turned out to be a
surprise. After some investigation, I found that different R sessions
of the program used the same seed. Simply, in R210, if I start R and
type rnorm(1), I always get the same random number. This is
contradictary to what is in the R document
Initially, there is no seed; a new one is created from the
current time when one is required. Hence, different sessions will
give different simulation results, by default.
I just installed the development version R220. Different sessions of R
do use different seeds as expected.
Jason Liao, http://www.geocities.com/jg_liao
Dept. of Biostatistics, http://www2.umdnj.edu/bmtrxweb
University of Medicine and Dentistry of New Jersey
683 Hoes Lane West, Piscataway NJ 08854
phone 732-235-5429, School of Public Health office
phone 732-235-9824, Cancer Institute of New Jersey office
More information about the R-help
mailing list