How would create a random number generator between the limits of 1 and 20 for a multiple choice test??
Printable View
How would create a random number generator between the limits of 1 and 20 for a multiple choice test??
See the VB help on the Rnd function
Private Function RandomNum() As Integer
RandomNum = Int((20 - 1 + 1) * Rnd + 1)
End Function
Add Randomize to hayessj's soultion or your set of random numbers will repeat each time you run the program.
Private Function RandomNum() As Integer
Randomize
RandomNum = Int((20 - 1 + 1) * Rnd + 1)
End Function
------------------
Marty