MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

maths/monte_carlo_dice.py:9–11  ·  view source on GitHub ↗

Initialize a six sided dice

(self)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected