I have this shuffling method in the Deck
class:
public Card[] deck = new Card[DECK_AMOUNT];
public void shuffleCards()
{
Random randInt = new Random();
for (int i = 0; i < 52; i++)
{
int firstCard = i;
int secondCard = randInt.Next(0, 51);
int tempFirstCard = firstCard;
deck[i] = deck[secondCard];
deck[secondCard] = deck[i];
}
}
And when I make these properties:
private Deck computerCards;
private Deck playerCards;
And use these methods
private void shuffleDecks(){
computerCards.shuffleCards();
playerCards.shuffleCards();
}
They both have the same cards on the same positions. Why does this happen and how do I solve it?
If I were to do
private void shuffleDecks(){
computerCards.shuffleCards();
playerCards.shuffleCards();
playerCards.shuffleCards();
}
They are both different.