Mail Archives: djgpp/1998/01/18/19:45:45
Jeff W./DMT wrote:
>
> how do I get a random number from 0 to N in DJGPP? I tried looking
> up: random, srandom, and rand but none seem to help. SRand says it
> returns a number from 0 to RAND_MAX, and random returns a numbre from
> 0 to MAX_INT. Neither is what I'm looking for. Thanks for your help.
(int)( N*( ((double)rand())/RAND_MAX )
--
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA
mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/
- Raw text -