Skip to content

Instantly share code, notes, and snippets.

@oskarth
Created March 20, 2016 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oskarth/1d2a1772d11006f45a32 to your computer and use it in GitHub Desktop.
Save oskarth/1d2a1772d11006f45a32 to your computer and use it in GitHub Desktop.
Precomputing a series of 5 As and 5 Bs in a secret random order.
# Usage:
# python rands.py
#
# 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]
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment