delorie.com/archives/browse.cgi | search |
From: | Sean Proctor <sproctor AT ccs DOT neu DOT edu> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Random Numbers? |
Message-ID: | <g1l4mso3h3hote2qeh6ehtf2mjo8jva5es@4ax.com> |
References: | <Vzl85.6589$MS3 DOT 136169 AT news1 DOT online DOT no> <0104ms87u2hnotrl96vre4g12upkdmnrbu AT 4ax DOT com> |
X-Newsreader: | Forte Agent 1.7/32.534 |
MIME-Version: | 1.0 |
Lines: | 11 |
Date: | Tue, 04 Jul 2000 21:14:14 GMT |
NNTP-Posting-Host: | 207.16.153.219 |
X-Complaints-To: | Abuse Role <abuse AT enter DOT net>, We Care <abuse AT newsread DOT com> |
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 <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p> 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |