[Rd] wishlist: add get_seed() function to standalone R library (PR#3160)

htang at hpl.hp.com htang at hpl.hp.com
Mon Jun 2 10:36:33 MEST 2003


Full_Name: Hsiu-Khuern Tang
Version: 1.7.0
OS: Debian GNU/Linux unstable
Submission from: (NULL) (66.32.185.71)


Hi all,

   This report is about the use of R as a standalone library, for linking with a
C program, for example.

   I have found it useful to be able to save the seeds of a random number
generator and restore it in a subsequent invocation of that program.  This
ensures continuity from one invocation to the next.  The file
src/nmath/standalone/sunif.c contains the function set_seed() for setting the
seeds of the Marsaglia-multicarry RNG; it would be nice to have get_seed()
defined simply as follows:

void get_seed(unsigned int *i1, unsigned int *i2)
{
    *i1 = I1; *i2 = I2;
}

Also, Rmath.h will have to contain the function prototype declaration for
get_seed.

Thanks a lot!

Best,
Hsiu-Khuern Tang.



More information about the R-devel mailing list