From: Edward Hill Newsgroups: comp.os.msdos.djgpp Subject: Re: rand() function Date: Thu, 21 Jan 1999 15:19:02 -0800 Organization: Easams, Engineering Systems Lines: 17 Message-ID: <36A7B5E6.656D@gec.nospam.com> References: <36A72C2A DOT 3DAF8CFE AT cryogen DOT com> <787bpa$5da$1 AT antares DOT lu DOT erisoft DOT se> NNTP-Posting-Host: pc02372.gmsws.gecm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01C-GECMMTL (Win95; I; 16bit) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Martin Stromberg wrote: : : FireFoX McLouD (firefox AT cryogen DOT com) wrote: : : How can I redefine the RAND_MAX parameter to use rand() with low : : numbers? : : You can't; it's not there to change. try int random; random = (int)((double)rand() / ((double)RAND_MAX + 1) * N) will give a random number from 0 - N don't forget to set the seed though. Ed Hill