| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
| X-Trace-PostClient-IP: | 68.147.225.57 |
| From: | Brian Inglis <Brian DOT Inglis AT SystematicSW DOT Invalid> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: random() : What am I doing wrong? |
| Organization: | Systematic Software |
| Message-ID: | <jcsvd3d4a5i64aoc9k7gddbfj1lpefdg2d@4ax.com> |
| References: | <N1GBi.41236$S91 DOT 9560 AT newsfe7-win DOT ntli DOT net> <13drciokqdoav65 AT corp DOT supernews DOT com> <200709041948 DOT l84JmRfh001331 AT envy DOT delorie DOT com> |
| X-Newsreader: | Forte Agent 1.93/32.576 English (American) |
| MIME-Version: | 1.0 |
| Lines: | 16 |
| Date: | Thu, 06 Sep 2007 12:27:15 GMT |
| NNTP-Posting-Host: | 64.59.135.176 |
| X-Complaints-To: | abuse AT shaw DOT ca |
| X-Trace: | pd7urf1no 1189081635 64.59.135.176 (Thu, 06 Sep 2007 06:27:15 MDT) |
| NNTP-Posting-Date: | Thu, 06 Sep 2007 06:27:15 MDT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
On Tue, 4 Sep 2007 15:48:27 -0400 in comp.os.msdos.djgpp, DJ Delorie
<dj AT delorie DOT com> wrote:
>
>> What about if I want to generate numbers in the range of 1 through 50?
>> How do I specify my range?
>
>Take the result and "% 50".
(x % 49) + 1; % => 0..49; + => 1..50
--
Thanks. Take care, Brian Inglis Calgary, Alberta, Canada
Brian DOT Inglis AT CSi DOT com (Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca)
fake address use address above to reply
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |