I'm wanting to make a random number generator. It's for school homework. I just can't seem to get it to work.
The task was to make a random number generator to generate 20 numbers into 20 text boxes to ask 10 maths questions.
It needs to be as efficient as possible. I need help as I can only do it but it's really inefficient and really long code.
Dim RandomNumberAHigh As Integer = 12 'Here I am declaring my highest number for the random number generator to use. This will be the highest number the maths quiz will ask the students in the questions.
Dim RandomNumberALow As Integer = 1 'Here I am declaring my lowest number for the random number generator to use. This will be the lowest number the maths quiz will ask the students in the questions.
Dim Random As Integer = 0 'Her I am declaring a variable that will be used to insert the numbers from the random number generator in the quiz text boxes.
Randomize()
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd1.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd4.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd7.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd10.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd13.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd16.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd19.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd22.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd25.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd28.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd3.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd6.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd9.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd12.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd15.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd18.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd21.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd24.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd27.Text = (Random)
Random = Int((RandomNumberAHigh - RandomNumberALow + 1) * Rnd() + RandomNumberALow)
Rnd30.Text = (Random)