Beispiel #1
0
        private void Shuffle()
        {
            // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
            int n = Cards.Count;

            while (n > 1)
            {
                n--;
                int      k     = SeededRandom.Next(n + 1);
                CardType value = Cards[k];
                Cards[k] = Cards[n];
                Cards[n] = value;
            }
        }
Beispiel #2
0
        private List <CardType> Shuffle(List <CardType> cards)
        {
            // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
            int n = cards.Count;

            while (n > 1)
            {
                n--;
                int      k    = SeededRandom.Next(n + 1);
                CardType card = cards[k];
                cards[k] = cards[n];
                cards[n] = card;
            }
            return(cards);
        }