Anonymous user
Playing cards: Difference between revisions
→replaced custom comparer sort with Knuth shuffle
Line 347:
public void Shuffle() {
// using Knuth Shuffle (see at http://rosettacode.org/wiki/Knuth_shuffle)
Random
Card temp;
for (int i = 0; i < deck.Count; i++){
}▼
j = random.Next(deck.Count);
deck[j] = temp;
▲ }
}
public Card Deal() {
Card r = this.deck[0];
this.deck.RemoveAt(0);
|