Skip to content

Instantly share code, notes, and snippets.

Created Mar 20, 2016
What would you like to do?
Precomputing a series of 5 As and 5 Bs in a secret random order.
# Usage:
# python
# head -n 1 output
# head -n 2 output
# etc...
import random
f = open('output', 'w')
lst = [0]*5 + [1]*5
for i in range(10):
idx = random.randint(0, len(lst)-1)
f.write(str(lst[idx]) + '\n')
del lst[idx]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment