MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / Dice

Class Dice

maths/monte_carlo_dice.py:6–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class Dice:
7 NUM_SIDES = 6
8
9 def __init__(self):
10 """Initialize a six sided dice"""
11 self.sides = list(range(1, Dice.NUM_SIDES + 1))
12
13 def roll(self):
14 return random.choice(self.sides)
15
16
17def throw_dice(num_throws: int, num_dice: int = 2) -> list[float]:

Callers 1

throw_diceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected