Skip to content

Instantly share code, notes, and snippets.

@catupper
Created January 8, 2012 20:37
Show Gist options
  • Select an option

  • Save catupper/1579598 to your computer and use it in GitHub Desktop.

Select an option

Save catupper/1579598 to your computer and use it in GitHub Desktop.
from __future__ import division
from random import randint
def dices(a):
t=randint(1,6)
j=1
res=1
while(a!=j):
p=randint(1,6)
if(p==t):
j+=1
else:
j=1
res+=1
t=p
return res
def kakuritu(x):
res=dices(x)
for a in range(1,10000):
res=((res*a)+dices(x))/(a+1)
print res
kakuritu(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment