Skip to content

Instantly share code, notes, and snippets.

@darkfeline
Created May 15, 2017 00:19
Show Gist options
  • Save darkfeline/88f4cf93b62eb9c62ee36455e6fa54a4 to your computer and use it in GitHub Desktop.
Save darkfeline/88f4cf93b62eb9c62ee36455e6fa54a4 to your computer and use it in GitHub Desktop.
kakutora SR probability calculator
import random
good = 0
total = 0
def draw10():
return sum(draw() for _ in range(10))
def draw():
"""Return draw good."""
return random.random() < 0.03
for _ in range(1000000):
x = 0
while True:
x += 1
if draw10() > 0:
break
good += x
total += 1
print(good / total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment