From: "Pieter van Ginkel" To: , Subject: Re: How to limit a random() with DJGPP ? Date: Wed, 25 Feb 1998 15:29:56 +0100 Message-ID: <01bd41f9$d7ef7aa0$cd2f86c2@pieter> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Precedence: bulk What I always do is this #define Random(x) (random() % x) and then just use Random. This works quite well. The only thing with this is that you can't get random numbers bigger that MAXINT. I think rand() does this but you should find that out yourself. If you want to have a random function that gives a floatingpoint result, usae something like this. #define FPRandom() (random() / (double)MAXINT) Foxe, home.westbrabant.net/~pginkel (Is going to be better if I finally get the time...) -----Oorspronkelijk bericht----- Van: Stephan Nieuwsgroepen: comp.os.msdos.djgpp Aan: djgpp AT delorie DOT com Datum: woensdag 25 februari 1998 1:13 Onderwerp: Re: How to limit a random() with DJGPP ? >i have put a randomize example on my page under tutorials. >go to: http://www.mygale.org/03/mine/ >-- >**************************************** >* THE DJGPP MINE !!! * >* FREE SOURCE CODES, FAQ, INFOS, LINKS * >**************************************** >* http://www.mygale.org/03/mine/ * >**************************************** >* 24h/24h 7/7days * >****************************************