LordofShadows
Programmer
I am writing a program that simulates the card game "War". I have most of it written, but I am stuck at "shuffling" the cards. I've already created an array that has all 52 cards, and I have an array set up to take in those cards randomly. Here's my problem: I'm using a For...Next loop with an Rnd statement inside it:
For x = 0 To 51
Randomize Timer
y = Int(51 * Rnd)
ShufCardArray(x, 0) = CStr(CardArray(y, 0))
ShufCardArray(x, 1) = CStr(CardArray(y, 1))
Next x
The only part that is not working is that "y" isn't always a different value. Is there any way I can prevent "y" from receiving the same random value?
For x = 0 To 51
Randomize Timer
y = Int(51 * Rnd)
ShufCardArray(x, 0) = CStr(CardArray(y, 0))
ShufCardArray(x, 1) = CStr(CardArray(y, 1))
Next x
The only part that is not working is that "y" isn't always a different value. Is there any way I can prevent "y" from receiving the same random value?