cvs.gedasymbols.org/archives/browse.cgi | search |
From: | thiagofga AT ambr DOT com DOT br |
Message-Id: | <3.0.5.32.19990729140850.007d5290@200.252.238.1> |
X-Sender: | thiagofga AT 200 DOT 252 DOT 238 DOT 1 |
X-Mailer: | QUALCOMM Windows Eudora Light Version 3.0.5 (32) |
Date: | Thu, 29 Jul 1999 14:08:50 -0300 |
To: | djgpp AT delorie DOT com |
Subject: | Re: -- Random question -- |
In-Reply-To: | <7nd0vu$igt$1@zingo.tninet.se> |
Mime-Version: | 1.0 |
Reply-To: | djgpp AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
At 20:29 24/07/99 +0200, you wrote: >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? Do like this: random()%100 + 1;
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |