On Tue, 2004-03-23 at 02:40, Prof Brian Ripley wrote: > On Mon, 22 Mar 2004, Rajarshi Guha wrote: > > > Hello, > > I have some C code that I'm interfacing to R using the .C calling > > interface. Currently the C code uses the rand() function from the GNU C > > library to generate random numbers. Since I need the random numbers in a > > range from 0 to a (where a is an integer) I use the RAND_MAX macro as > > > > (int)(rand() * (float)(*nobs-1) / (RAND_MAX+1.0)) > > > > (taken from the rand() manpage) > > That isn't a random *number*: it is a random *integer*. It is a random > integer on 0, ..., a=*nobs-2: is that what you wanted?
Yes. Thank you for the pointers ------------------------------------------------------------------- Rajarshi Guha <[EMAIL PROTECTED]> <http://jijo.cjb.net> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE ------------------------------------------------------------------- Does Ramanujan know Polish? -- E.B. Ross ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
