Last active
September 4, 2018 09:41
-
-
Save alperozaydin/88052be5a0c4a96f80bfae73cd563894 to your computer and use it in GitHub Desktop.
match
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 | |
rng = 1000000.0 | |
people = [0, 0, 0, 0, 0] | |
for k in range(0, int(rng)): | |
match = [True, True, True, True, False] | |
random.shuffle(match) | |
min = 0 | |
max = 4 | |
for i in range(0, 5): | |
x = random.randint(min,max) | |
if match[x] == False: | |
people[i] = people[i] + 1 | |
break | |
match.pop(x) | |
max = max - 1 | |
for item in people: | |
print str(float((item)/rng)*100) + "%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment