public void Shuffle(Card[] cards, int steps) { var random = new Random(); for (int i = 0; i < steps; i++) { var firstIndex = random.Next(0, Constants.SUIT_SIZE * Constants.DECK_COUNT); var secondIndex = random.Next(0, Constants.SUIT_SIZE * Constants.DECK_COUNT); Swap(cards, firstIndex, secondIndex); } }
public void Swap(Card[] cards, int firstIndex, int secondIndex) { var card = cards[firstIndex]; cards[firstIndex] = cards[secondIndex]; cards[secondIndex] = card; }
private void InitializeDeck() { Cards = new Card[Constants.SUIT_SIZE * Constants.DECK_COUNT]; CreateDeckSuit(SuitEnum.CLUBS,0); CreateDeckSuit(SuitEnum.DIAMONDS,1); CreateDeckSuit(SuitEnum.HEARTS,2); CreateDeckSuit(SuitEnum.SPADES,3); }