Last active
April 13, 2020 18:20
-
-
Save andybrodie/e0313f26a44af74ca727c41320ed7636 to your computer and use it in GitHub Desktop.
This file contains 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
from random import seed | |
from random import randint | |
successes = 0 | |
failures = 0 | |
count = 0 | |
print("Starting loop") | |
while (count<1000000): | |
max_length = 10000 | |
break1 = randint(0, max_length) | |
break2 = break1 | |
while (break1 == break2): | |
break2 = randint(0, max_length) | |
x = min(break1, break2) | |
y = max(break1, break2) - x | |
z = max_length - y - x | |
count = count + 1 | |
if (x + y >= z and x + z >= y and z + y >= x): | |
successes = successes + 1 | |
else: | |
failures = failures + 1 | |
print("Successes : ", successes) | |
print("Failures : " , failures) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment