Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
szczys committed Dec 28, 2013
0 parents commit adcd0f7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nfc-voting
==========

Python script generates unique values
32 changes: 32 additions & 0 deletions unique-string-gen/unique-string-gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
###########
# Generate Unique Strings
# - Store them as a pickle file
###########

# References:
# http://stackoverflow.com/questions/2257441/python-random-string-generation-with-upper-case-letters-and-digits

import string
import random
import pickle

setSize = 500
uniqueLen = 4

uniqueSet = []

print "Generating Set"
while (len(uniqueSet) < setSize):
if len(uniqueSet)%50 == 49:
print str(len(uniqueSet)+1) + " values have been generated"
n = random.choice(range(0xFFFF))
if n not in uniqueSet:
uniqueSet.append(n)

pickle.dump(uniqueSet, open( "uniqueSet.pkl", "wb"))

print "Saved to uniqueSet.pkl"
print



0 comments on commit adcd0f7

Please sign in to comment.