- Home
·
- Math/Dates
·
- This little gem will create a string of randomly generated numbers from 1 to 20, with NO REPITIONS!
This little gem will create a string of randomly generated numbers from 1 to 20, with NO REPITIONS!
This little gem will create a string of randomly generated numbers from 1 to 20, with NO REPITIONS! Just create a text box (Text1) and a
Rate This little gem will create a string of randomly generated numbers from 1 to 20, with NO REPITIONS!
(1(1 Vote))
Dim Sequence(1 To 20) As Integer 'This is where the numbers will be
For i = 1 To 20 ' stored.
redo:
Sequence(i) = Int(Rnd * 20) + 1
If i > 1 Then 'Check to see if any of the previous numbers
For j = 1 To i - 1 ' are the same as Sequence(i).
If Sequence(j) = Sequence(i) Then GoTo redo
Next j
End If
Next i
Text1.Text = ""
For k = 1 To 20
Text1.Text = Text1.Text & Sequence(k)
If k < 20 Then Text1.Text = Text1.Text & ", " 'Adds commas between ea #
Next k
End Sub
This little gem will create a string of randomly generated numbers from 1 to 20, with NO REPITIONS! Comments
No comments yet — be the first to post one!
Post a Comment