From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: getting a ranged random number, how? Date: Sun, 27 Dec 1998 02:01:11 -0500 Content-Transfer-Encoding: 7bit References: <3685970D DOT 271BE4C6 AT market DOT forsale> X-Posted-Path-Was: not-for-mail X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-ELN-Date: 27 Dec 1998 07:01:35 GMT X-ELN-Insert-Date: Sat Dec 26 23:05:04 1998 Organization: Nocturnal Aviation Lines: 17 Mime-Version: 1.0 NNTP-Posting-Host: 1cust133.tnt14.nyc3.da.uu.net Message-ID: <3685DB37.3EC8E298@earthlink.net> X-Mailer: Mozilla 4.5 [en] (Win95; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com DeHackEd wrote: > > A common practice is to do this: > > int num = rand() % max; > > Num now contains a number between 0 and (max - 1). If max is 10, it holds from 0 > to 9. Does this help? It shouldn't help. If it is a common practice, then common practice is bad. Get and read the comp.lang.c FAQ from ftp://rtfm.mit.edu/pub/usenet/ -- Martin Ambuhl (mambuhl AT earthlink DOT net) Note: mambuhl AT tiac DOT net will soon be inactive