hello all,

I use the R standalone math library in my own C program, and the default R
random number generator can be seeded with

set_seed(const unsigned int, const unsigned int).

How could I seed the RNG with an instance of .Random.seed ?



I would need this or a similar workaround for debugging purposes.

More precisely, I use the default R random number generator to sample from
various distributions in my own C code

SEED<- .Random.seed
save(SEED, args, file= "last.call.R")
out<- .Call("my.fun", args)

and can reproduce segmentation faults etc via

load("last.call.R")
.Random.seed<- SEED
out<- .Call("my.fun", args)

In order to use valgrind, I wrote a little C program "debug.my.fun" that
reads in 'args' and 'SEED',
and then calls "my.fun" (without the SEXP overhead of course).

But the seeds are not set accordingly and segmentation faults are not
reproducible.
More precisely, I need to replace the set_seed line in the following snippet
with something else.

#include <Rmath.h>
int main(int argc,char* argv[])
{
    const unsigned int SEED1= 12345, SEED2= 67890;
    set_seed(SEED1, SEED2);

...

}




Thanks in advance,
Oliver

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to