-
Hi
could someone help me to do this...
I Have a string var. Array with 60 different Places to hold info (It's a Type called Deck .. Ie... Deck1.Card1 = "Ace"
How Can I tell it to switch Those Randomly with out alot of fuss.. (You know shuffle the deck) maybe with a api somehow..
Thankyou all..
Evan
-
This is not a complete answer to your problem, and most likely there is a better way to do even this, but the following will result in MyCollection containing a set of 60 non-repeating numbers from 1 to 60.
Code:
Dim nTry As Integer
Dim nAddCount As Integer
Dim bFound As Integer
Dim nDummy As Integer
Dim MyCollection As New Collection
Randomize
Do Until nAddCount = 60
nTry = Int((60 - 1 + 1) * Rnd + 1)
On Error Resume Next
nDummy = MyCollection.Item(CStr(nTry))
bFound = (Err = 0)
If bFound Then
Err.Clear
Else
MyCollection.Add nTry, CStr(nTry)
nAddCount = nAddCount + 1
End If
Loop
------------------
Marty