From: "Martin Peach" Newsgroups: comp.os.msdos.djgpp Subject: Re: Random Numbers Date: Tue, 23 Nov 1999 11:12:21 -0500 Organization: Communications Accessibles Montreal, Quebec Canada Lines: 11 Message-ID: <81eed6$gt4@tandem.CAM.ORG> References: <006001bf3558$48151a80$3af838ca AT home-computer> NNTP-Posting-Host: dialup-85.hip.cam.org X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > randomnumber = (random() % 79) + 1; This won't be good enough for lottery applications and such unless the largest possible number returned by random() is an integral multiple of 79, otherwise 79 won't occur as often as the other numbers. You'll have to scale the numbers first using floating point math (random()*79/_THE_LARGEST_RANDOM_NUMBER) and then round to integer, being very careful how your rounding function works and the adding your offset of 1 if you don't want any zeros. \/\/\/*= Martin