private static void Shuffle(List <card> deck) //shuffle deck { Random rand = new Random(); card temp = new card(); int cardNumber; for (int i = 0; i < deck.Count; i++) { cardNumber = rand.Next(deck.Count); temp = deck.ElementAt(i); deck[i] = deck.ElementAt(cardNumber); deck[cardNumber] = temp; } }
private static List <card> CreateCards() //creats deck { string[] suits = { "Diomands", "Spades", "Clubs", "Hearts" }; string[] ranks = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "king" }; List <card> deck = new List <card>(); for (int i = 0; i < suits.Length; i++) { for (int j = 0; j < ranks.Length; j++) { card c = new card(); c.Suit = suits[i]; c.Rank = ranks[j]; deck.Add(c); } } return(deck); }