[R] random seed

Kosuke Imai kimai at Princeton.Edu
Fri Sep 10 16:54:19 CEST 2004


Hi,
  I have a R wrapper function that calls my C code via .C(). In my C code,
I have been calling GetRNGstate() (and PutRNGstate()) once at the
beginning (and the end) of the code. However, if I generate a random
number within the R wrapper function (say via runif()), then my C code
produces the exactly same numbers. If I don't generate a random number 
within the wrapper, it works fine. I wonder if there is something I need 
to do in order to prevent this problem. Any help would be appreciated.
Best,
Kosuke

---------------------------------------------------------
Kosuke Imai               Office: Corwin Hall 041
Assistant Professor       Phone: 609-258-6601 
Department of Politics    eFax:  973-556-1929
Princeton University      Email: kimai at Princeton.Edu
Princeton, NJ 08544-1012  http://www.princeton.edu/~kimai




More information about the R-help mailing list