From c7b6b0fc60811aed22de51d79702629272ac725a Mon Sep 17 00:00:00 2001 From: Emmanuel Okwudike <34962281+iameo@users.noreply.github.com> Date: Wed, 23 Mar 2022 06:01:46 +0100 Subject: [PATCH] a more intuitive randint Awesome project! (the little change contributed here is for a more efficient randint for this use-case: "Class(random.SystemRandom()) that uses the os.urandom() function for generating random numbers from sources provided by the operating system. Does not rely on software state, and sequences are not reproducible." [random.SystemRandom](https://docs.python.org/3/library/random.html#random.SystemRandom) --- Refactoring/refactoring_4_encapsulation/player.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Refactoring/refactoring_4_encapsulation/player.py b/Refactoring/refactoring_4_encapsulation/player.py index a90f100..d4620fc 100644 --- a/Refactoring/refactoring_4_encapsulation/player.py +++ b/Refactoring/refactoring_4_encapsulation/player.py @@ -17,7 +17,7 @@ def take_turn(self): @staticmethod def _roll(): - return random.randint(1, 6) + return random.SystemRandom().randint(1,6) def __str__(self): return f'Player {self.num}'