Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
Index your code
hub
/
github.com/TheAlgorithms/Python
/ roll
Method
roll
maths/monte_carlo_dice.py:13–14 ·
view source on GitHub ↗
(self)
Source
from the content-addressed store, hash-verified
11
self.sides = list(range(1, Dice.NUM_SIDES + 1))
12
13
def
roll(self):
14
return
random.choice(self.sides)
15
16
17
def
throw_dice(num_throws: int, num_dice: int = 2) -> list[float]:
Callers
2
_choose_a2
Method · 0.80
throw_dice
Function · 0.80
Calls
no outgoing calls
Tested by
no test coverage detected