Imported time module and modified random.seed to use computer time to seed the random generator for a better random.shuffle.
This commit is contained in:
parent
3b38ea281f
commit
fb0db229c2
@ -1,6 +1,7 @@
|
|||||||
# 5-Card_Stud_Poker_Game.py
|
# 5-Card_Stud_Poker_Game.py
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
import time
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from hand_utils import evaluate_hand, Tuple, List, Card, SUITS, RANKS
|
from hand_utils import evaluate_hand, Tuple, List, Card, SUITS, RANKS
|
||||||
|
|
||||||
@ -224,6 +225,7 @@ def reset_round(players):
|
|||||||
class Deck:
|
class Deck:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.cards: List[Card] = [Card(rank, suit) for suit in SUITS for rank in RANKS]
|
self.cards: List[Card] = [Card(rank, suit) for suit in SUITS for rank in RANKS]
|
||||||
|
random.seed(time.time())
|
||||||
random.shuffle(self.cards)
|
random.shuffle(self.cards)
|
||||||
|
|
||||||
def deal_card(self) -> Card:
|
def deal_card(self) -> Card:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user