Files
Wyvern-Castle/dice.py
2026-01-25 16:07:28 +01:00

17 lines
427 B
Python

import random as rd
class Dice():
def __init__(self):
raise TypeError("Un dé ne peut pas être instanciée!")
@staticmethod
def roll(self, num_faces=20):
return rd.randrange(start=1, stop=num_faces+1, step=1)
@staticmethod
def head_or_tails():
result = rd.randint(0,1)
if result: # true
return "head" # face
else:
return "tails" # pile