I'm trying to write a code that will generate random numbers and no number appears more than onece.


For I = 0 To 3 
    For J = 0 To I 
        Do 
            n = Int(4 * Rnd) + 1 'random number generated
            Array1(I) = n 'random number settled in an array
            If (I = I - J) Then 'checking for the same place in array
                numsOK = True 
            Else 
                If Array1(I) = Array1(I - J) Then 'comparing two different places in an array
                    numsOK = False 
                Else 
                    numsOK = True 
                End If 
            End If 
             
        Loop Until numsOK = True 
    Next J 'only the last number and the first one always differ, other numbers repeat
Next I Plz help me and tell why the program isnt working. I have no idea, how to make it work.