hello everyone. i need to check if random number generated each time button clicked have not been generated before. i'm saving random number to array each time button clicked then i need to check if after second click of the button numbers are different if not then generate new random number compare it and if it is not the same as other numbers that have been generated before, then pass it to other function.
heres what i've tried:
' Dimension the variables used in the programme
Dim intNumber As Integer
Dim randGenerator As New Random
Dim arrNumber(100) As String
Dim x As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'generating random number
intNumber = randGenerator.Next(0, 10)
'saving number generated to a string!
arrNumber(x) = intNumber
x += 1
'checking if number genareted have not been generatedd before
For i = 0 To arrNumber.Length - 1
If arrNumber(i) = intNumber Then
MsgBox("number have been generated before!")
intNumber = randGenerator.Next(0, 10)
End If
Next
'rest of the code
End Sub