|
-
Aug 18th, 2000, 06:01 PM
#1
Thread Starter
Fanatic Member
Does anybody know how to make a random number thats not between 1 - 0?
Im traying to make a simple game to teach myself, and im traying to generate a random number from 1 - 11.
Thanks!
ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet? 
-
Aug 18th, 2000, 08:41 PM
#2
Hyperactive Member
Once you have a random number that is between 0-1 you multiply it by 11, round down, and add one.:
double tempValue = Math.random() * maxValue;
int value = (int) Math.floor(tempValue) + 1;
Thats acually a bit more code then you need.
"People who think they know everything are a great annoyance to those of us who do."
-
Aug 19th, 2000, 07:50 PM
#3
Thread Starter
Fanatic Member
ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet? 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|