From: swarsmatt AT aol DOT com (SWars Matt) Newsgroups: comp.os.msdos.djgpp Subject: Re: How to limit a random() with DJGPP ? Date: 6 Feb 1998 02:54:44 GMT Lines: 17 Message-ID: <19980206025400.VAA01280@ladder03.news.aol.com> NNTP-Posting-Host: ladder03.news.aol.com Organization: AOL http://www.aol.com References: <6bdeu3$evr$1 AT news4 DOT isdnet DOT net> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk >Hi ! I started coding some kind of game a few days ago, and was surprised by >how easy it was to move from Turbo Pascal to C. Allegro is such a wonderful >piece of code that everything is made easy, even for newcomers. In fact, all >my problems come from DJGPP itself. And the most important one is that I >can't find a way to call a limited random(). Was random(10) or anything else >in Turbo Pascal... what about the same thing with DJGPP ? Thanks to anyone >who could help me ! > > Hoi, JCx. > jicehix AT worldnet DOT fr > >P.S: if you answer to the group, please crossport an e-mail :) > I think rand() % 10 would do what your looking for - % is the modulus operator, so it limits a result to that range. I'm not sure this is 'the best' way to do it, but it should work.