Skip to content

Instantly share code, notes, and snippets.

@oskarth oskarth/rands.py
Created Mar 20, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.