From: "James Bunting" Newsgroups: comp.os.msdos.djgpp References: Subject: Re: Random Date: Sun, 25 Apr 1999 15:26:44 +0100 Lines: 36 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 NNTP-Posting-Host: warp8-38.enta-net.co.uk Message-ID: <3723299c.0@energise.enta.net> X-Trace: 25 Apr 1999 15:41:32 -0100, warp8-38.enta-net.co.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Sure... int RandomNumber( int a, int b) { int temp; // make sure that a > b if( a > b) { temp = a; a = b; b = temp; } return a + (rand()%(b-a+1)); } That ought to do it -- James Bunting james AT aic DOT co DOT uk http://www.aic.co.uk/~james/ "Playing games is an addiction, creating them is an art" - [Me] Anders Pedersen wrote in message news:inlU2.200$HM6 DOT 250 AT news DOT get2net DOT dk... > Will somebody please show me how to get an random number between a and b? > >