delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/28/21:17:35

From: "Börje Granberg" <borje DOT granberg AT ebox DOT tninet DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: -- Random question --
Date: Sat, 24 Jul 1999 20:29:50 +0200
Organization: Telenordia
Lines: 13
Message-ID: <7nd0vu$igt$1@zingo.tninet.se>
NNTP-Posting-Host: du126-152.ppp.algonet.se
X-Trace: zingo.tninet.se 932841278 18973 195.100.152.126 (24 Jul 1999 18:34:38 GMT)
X-Complaints-To: abuse AT algo DOT net
NNTP-Posting-Date: 24 Jul 1999 18:34:38 GMT
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
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I know there are commands like rand() and random() but how do I get a random
number between 1 and 100?

In BASIC it is easy because there you get a random (float) number between 0
and 1 that you can multiplicate with 100 and add 1, but I dont see that
opportunity in C++ or have my eyes missed that part?


--
/Börje



- Raw text -


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