I'm trying to generate random numbers depending on the user Input. So if the user inputs 10 then I want to generate 10 random numbers.I'm getting the user input from a textbox.
private void GenerateRandomNumber()
{
int count = 1;
//Int32.TryParse(GeneratetextBox.Text, out UserNumber);
UserNumber = Convert.ToInt32(GeneratetextBox.Text);
///creates random object to produce random values
Random randomNumbers = new Random();
while (count == UserNumber)
{
//UserNumber = randomNumbers.Next(100);
listBox.Items.Add(randomNumbers.Next(100));
count = count + 1;
}
//for ( count = UserNumber; count == UserNumber; count++)
//{
// UserNumber = randomNumbers.Next(100);
// listBox.Items.Add(randomNumbers.Next(100));
// count = count + 1;
//}
}