Random Number Generation with a Twist
Ok. This is not going to be the simplest thing to describe in a post. So, if I've confused anyone, please let me know. What I want to do is done in three steps.
Step One: I want to generate a random number to fall within a range between 0 and 100. I honestly think that this will be really easy. Now, this number will used to determine my game's start up options.
Step Two: I want to test that number on a sliding scale of 0 to 100. For example, when the program first launches all of the start up options will have an equal chance of being selected. So the initial scale will be:
0-20: Option 1
21-40: Option 2
41-60: Option 3
61-80: Option 4
81-100: Option 5
Step Three: Based on the initial option selection the above scale will change to something like the below (where option 1 was selected the first time out)
0-5: Option 1
6-10: Option 2
11-40: Option 3
41-50: Option 4
51-100: Option 5
What I'm hoping to get from people are thoughts/input on how this might be done.
Anyone? Any ideas?
Here is how I'm generating the random number. Just in case people need to do the same thing.
// Create a byte array and the generator to hold the random value.
byte randomNumber = new byte;
RNGCryptoServiceProvider Gen = new RNGCryptoServiceProvider();
// Fill the array with a random value.
// Convert the byte to an integer value to make the modulus operation easier.
int rand = Convert.ToInt32(randomNumber);
return rand % 100 + 1;
Why not simply use the System.Random class?
int num = new System.Random().Next(101);
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Last Post: 12-07-2007, 06:17 PM
Last Post: 12-13-2006, 03:49 PM
By cmvw in forum VB Classic
Last Post: 06-28-2006, 11:04 AM
By rewclaus in forum VB Classic
Last Post: 02-06-2006, 08:45 AM
By Jack Albert in forum VB Classic
Last Post: 01-24-2001, 12:24 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center