int cardPos = 0;
for (int i = 0; i < noOfDecks; i++)
{
for (byte j = 1; j < 53; j++)
{
decks[cardPos] = j;
cardPos++;
}
}
nextCard = 0;
}
private void shuffleShoe()
{
if (!testShoe)
{
System.Random rand = new Random();
byte swap;
int p1, p2;
for (int i = 0; i < decks.Length; i++)
{
p1 = rand.Next(decks.Length);
p2 = rand.Next(decks.Length);
swap = decks[p1];
decks[p1] = decks[p2];
decks[p2] = swap;
}
}
nextCard = 0;
}
/// <summary>
/// Gets the next card number from the deck
/// </summary>
/// <returns>The number of the next card</returns>
public byte NextCardNo()
{
if (nextCard == decks.Length)
{
shuffleShoe();
}
return decks[nextCard++];
}
/// <summary>
/// Gets the next card from the deck.
/// </summary>
/// <returns>A new instance of the card</returns>
public Card DealCard()
{
return new Card(NextCardNo());
}
/// <summary>