[R] random number generation issues with r and compiled C code

Faheem Mitha faheem at email.unc.edu
Fri Jan 25 07:35:36 CET 2002



On Thu, 24 Jan 2002, Prof Brian Ripley wrote:

> 3) When using standalone Rmathlib
>
>   A little care is needed to use the random-number routines. You will
>   need to supply the uniform random number generator
>
>   double unif_rand(void)
>
>   or use the one supplied (and with a shared library or DLL you will have
>   to use the one supplied, which is the Marsaglia-multicarry with an entry
>   point
>
>   set_seed(unsigned int, unsigned int)
>
>   to set its seeds).
>
> So, I'm not clear if you have supplied your own or used the one supplied,
> but if the latter, you need to call set_seed, *but only once*.

Thank you for the reply. I used the one supplied (set_seed). So can I call
set_seed from the top level of my C code; ie from main(), which then calls
other functions which call unif_rand() etc?

                                  Sincerely, Faheem Mitha.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list