static List <Card> GenerateDeckOfCards() { //Build deck of 52 unique playing cards var cardSuits = new string[] { "Spades", "Clubs", "Diamonds", "Hearts" }; var cardRanks = new string[] { "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace" }; var deckOfCards = new List <Card>(); for (var i = 0; i < cardSuits.Length; i++) { for (var j = 0; j < cardRanks.Length; j++) { var newCard = new Card(); newCard.CardRank = cardRanks[j]; newCard.CardSuit = cardSuits[i]; newCard.SetCardValue(); deckOfCards.Add(newCard); } } //Shuffle the deck of cards var tempSaveCard = new Card(); for (var i = 0; i < deckOfCards.Count; i++) { Random rnd = new Random(); int positionToSwap = rnd.Next(deckOfCards.Count); tempSaveCard = deckOfCards[i]; deckOfCards[i] = deckOfCards[positionToSwap]; deckOfCards[positionToSwap] = tempSaveCard; } return(deckOfCards); }