0

Here is some code that I have. I need to know if the technique I am using will fill the array named 'usednum' with truly random numbers or if the numbers are going to be repeated often in the same place. Also, is there a better randomizer I can use that is more 'random'. (PS. I am aware that GoTo is inefficient/hated but that is at the least of my concerns at the moment)

Sub Randomizer()
    For x = 0 To 9
Start:
        randomint = (Rnd() * 9) + 1

        If randomint = usednum(0) Then
            GoTo Start
        ElseIf randomint = usednum(1) Then
            GoTo Start
        ElseIf randomint = usednum(2) Then
            GoTo Start
        ElseIf randomint = usednum(3) Then
            GoTo Start
        ElseIf randomint = usednum(4) Then
            GoTo Start
        ElseIf randomint = usednum(5) Then
            GoTo Start
        ElseIf randomint = usednum(6) Then
            GoTo Start
        ElseIf randomint = usednum(7) Then
            GoTo Start
        ElseIf randomint = usednum(8) Then
            GoTo Start
        Else
            usednum(x) = randomint
        End If
    Next
End Sub
M Bloxman
  • 23
  • 6

0 Answers0