Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- num_tests = 100000
- choices = range(10)
- # Let's say choices 0 and 1 are the ones we want.
- successes = 0
- for i in range(num_tests):
- draw = np.random.choice(choices, size=3, replace=False)
- if 0 in draw or 1 in draw:
- successes += 1
- print "{} successes out of {} tries, leads to chance of {}".format(successes, num_tests, float(successes) / num_tests)
Add Comment
Please, Sign In to add comment