Created
December 7, 2016 04:29
-
-
Save amstocker/66409c8a9989b94728cfaf88f480d362 to your computer and use it in GitHub Desktop.
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
| from random import randrange | |
| N = 5 | |
| has_santa = set() | |
| is_santa = set() | |
| pairs = set() | |
| while len(has_santa) < N: | |
| santa_to_try = randrange(N) | |
| while santa_to_try in is_santa: | |
| santa_to_try = randrange(N) | |
| is_santa.add(santa_to_try) | |
| santee_to_try = randrange(N) | |
| while santee_to_try in has_santa or santa_to_try == santee_to_try: | |
| santee_to_try = randrange(N) | |
| has_santa.add(santee_to_try) | |
| pairs.add((santa_to_try, santee_to_try)) | |
| print(pairs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment