Created
May 15, 2017 00:19
-
-
Save darkfeline/88f4cf93b62eb9c62ee36455e6fa54a4 to your computer and use it in GitHub Desktop.
kakutora SR probability calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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