delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/25/00:27:00

From: neiled AT clara DOT net (Neil Edwards)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Random
Message-ID: <3721e674.2305619@news.clara.net>
References: <inlU2.200$HM6 DOT 250 AT news DOT get2net DOT dk>
X-Newsreader: Forte Agent 1.5/32.452
MIME-Version: 1.0
Lines: 17
Date: Sat, 24 Apr 1999 15:47:11 GMT
NNTP-Posting-Host: 195.8.88.62
X-Complaints-To: abuse AT clara DOT net
X-Trace: mors.clara.net 924968831 195.8.88.62 (Sat, 24 Apr 1999 16:47:11 BST)
NNTP-Posting-Date: Sat, 24 Apr 1999 16:47:11 BST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Sat, 24 Apr 1999 17:23:50 +0200, "Anders Pedersen"
<anders_p AT forum DOT dk> wrote:

>Will somebody please show me how to get an random number between a and b?
>
 rand() % b

so it can be modified to put limits on it

i.e. from 50 - 100

rand() % 50 + 50

so if its number is 50 then 50 + 50 is 100
if its 2 then 50 + 2 is 52, you get the idea!

- Neil Edwards

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019