Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Math solution in Clear category for Probably Dice by vby
import math
def probability(dice_number, sides, target):
p=0
if target>sides*dice_number:
return 0.0000
for i in range(0,int((target-dice_number)//sides)+1):
r=(-1)**i*math.factorial(dice_number)/(math.factorial(i)*math.factorial(dice_number-i))
t=math.factorial(target-i*sides-1)/(math.factorial(dice_number-1)*math.factorial(target-i*sides-1-dice_number+1))
p+=r*t
return round(1/(sides**dice_number)*p,4)
Feb. 3, 2019