[Rd] set_seed

Tong Wang wangtong at usc.edu
Tue May 15 08:01:34 CEST 2007


  In this case,  how do I choose numbers to make sure  set_seed(n1,n2)  and set.seed(n) produce the same result ?
I am asking because my C code worked correctly if I compile it to produce .exe file and ran it ,  but it gave strange results if it is compiled to .dll file and dynamically loaded into R and call with .C( ). 
   To debug,  I need to let them produce the same random number under two different situation so I can tell what is wrong in R. 

   Thanks a lot.

----- Original Message -----
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Date: Monday, May 14, 2007 9:40 pm
Subject: Re: [Rd] set_seed
To: Tong Wang <wangtong at usc.edu>
Cc: R-devel <r-devel at r-project.org>

> On Mon, 14 May 2007, Tong Wang wrote:
> 
> > Hi, All:
> 
> >   It seemed set_seed is usable only when Rmath is used as a 
> standalone 
> > library, then what should I use when I need to link to R.dll.
> 
> When you link to R.dll you are running R, so you can call 
> set.seed() via 
> eval or via do_setseed.
> 
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>



More information about the R-devel mailing list