I'm trying to get a random number generator to work that doesn't return any of the same values.
Here's what I have, but it doesn't work.
Dim intRand As Integer Dim temp As String Dim strUSED As String 'get random unused number Do Randomize() intRand = CInt(Int(20 * Rnd()) + 1) temp = CStr(InStr(strUSED, CStr(intRand))) If temp = Nothing Then strUSED &= intRand End If Loop Until temp = Nothing
The idea behind it is, it takes the random number between 1-20, checks in strUSED if its there, if it is, temp gets a value, and it loops to random again.
Thanks


Sign In
Create Account


Back to top









