Randomozing Arrays

voom

Newcomer
Joined
Dec 1, 2003
Messages
2
I am making a blackjack game and I have all the cards stored in an array. How can I randomize the array so that when crads are dealt it is random. Will there be problems drawing the same card twice?

Thanks in Advance
 
How are you making the cards different? Do you have some kind of an enumeration with all possible kinds or what? If you have an enumaration, it would the easiest way to do, using the Random object.
 
Check out wyrd's card games for guidance on shuffling your cards.
The Deck class has a Shuffle method that you can look at. It
basically just loops through every card and swaps the current
card in the loop with a random one.
 
Back
Top