Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am shadikka on github.
  • I am amhelin (https://keybase.io/amhelin) on keybase.
  • I have a public key ASA4iLKBHSp4YNpVTCVzzliW-xS5G8jIWhV_ryLERN1aWQo

To claim this, I am signing this object:

def dice(result, num, sides):
"""
Returns the chance of getting the exact result on `num` throws of dice with
the given amount of sides on the dice.
"""
if num == 1:
if 1 <= result <= sides:
return 1.0 / float(sides)
return 0
ret = 0