delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/16/10:45:21

From: "Börje Granberg" <borje DOT granberg AT ebox DOT tninet DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: ---Random question---
Date: Fri, 16 Jul 1999 15:55:44 +0200
Organization: Telenordia
Lines: 15
Message-ID: <7mnf45$pqb$2@cubacola.tninet.se>
NNTP-Posting-Host: du87-152.ppp.algonet.se
X-Trace: cubacola.tninet.se 932134853 26443 195.100.152.87 (16 Jul 1999 14:20:53 GMT)
X-Complaints-To: abuse AT algo DOT net
NNTP-Posting-Date: 16 Jul 1999 14:20:53 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