I have an array with 12 names already specified in it and I am trying to pull out 5 random names from that array(kinda like pulling names out of a hat), but the code I have duplicates the names. I don't know how to fix it.
Can anyone help? because I do not know anything about random generators.
Thanks
Code:
Public strName As Variant
Public arrayName() As String
Public Function PlayerNames() As Integer
Dim intRnd As Integer, i As Integer
strName = Array("Craig", "Derek", "Jeff", "Piggy", "Erin", "Bourge", "Kristen", _
"Mindy", "Gook", "Brett", "Jamie", "Peter")
ReDim arrayName(1 To 5) As String
For i = 1 To 5
Randomize
intRnd = Int((5 - 1)* Rnd) + 1
arrayName(i) = strName(intRnd)
Next i
End Function
Can anyone help? because I do not know anything about random generators.
Thanks