From: Sean Proctor Newsgroups: comp.os.msdos.djgpp Subject: Re: Random Numbers? Message-ID: References: <0104ms87u2hnotrl96vre4g12upkdmnrbu AT 4ax DOT com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 11 Date: Tue, 04 Jul 2000 21:14:14 GMT NNTP-Posting-Host: 207.16.153.219 X-Complaints-To: Abuse Role , We Care X-Trace: newshog.newsread.com 962745254 207.16.153.219 (Tue, 04 Jul 2000 17:14:14 EDT) NNTP-Posting-Date: Tue, 04 Jul 2000 17:14:14 EDT Organization: ENTER.net (enter.net) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Tue, 04 Jul 2000 15:23:08 GMT, Damian Yerrick wrote: > return rand() * (long long)range / (RAND_MAX + (long long)1) + min; I think better would be: return (rand() % (max - min + 1)) + min; as you don't have to use long long ints and do multiplication and division with them... etc. Sean