dimanche 8 décembre 2019

Retrieve random card from list using a method return value [duplicate]

static Cards Dealer(List<Cards> cards)
{
    var dealer = new Random();            
    return cards[dealer.Next(cards.Count)];
}

static void GameStart(double cash, List<Cards> cards, double wager)

Console.WriteLine("dealer has" + Dealer(cards).Name + " " + Dealer(cards).Suit);
Console.WriteLine("dealer has" + Dealer(cards).Name + " " + Dealer(cards).Suit);

I want to get a random card from my list but so far it returns the same card each time. Is there something I need to do to renew the random gen each time I call the method? much appreciated.




Aucun commentaire:

Enregistrer un commentaire