Skip to content

Instantly share code, notes, and snippets.

@catichenor
Created December 29, 2016 19:12
Show Gist options
  • Select an option

  • Save catichenor/074bca5f56e12d808bede9ae9bcca7df to your computer and use it in GitHub Desktop.

Select an option

Save catichenor/074bca5f56e12d808bede9ae9bcca7df to your computer and use it in GitHub Desktop.
Key generator test in Python
#!/usr/bin/python
import random
# int((random.random() * 90000) + 10000) # Yields numbers between 10000 and 99999
def numCheck(inDict):
inputLength = len(inDict)
while len(inDict) == inputLength:
try:
key = int(random.random() * 10)
inDict[key] = 0
except:
pass
print key
return inDict
dictCheck = {}
iter1 = numCheck(dictCheck)
print(iter1)
iter2 = numCheck(iter1)
print(iter2)
iter3 = numCheck(iter2)
print(iter3)
iter4 = numCheck(iter3)
print(iter4)
iter5 = numCheck(iter4)
print(iter5)
iter6 = numCheck(iter5)
print(iter6)
iter7 = numCheck(iter6)
print(iter7)
iter8 = numCheck(iter7)
print(iter8)
for k, v in iter8.items():
print(str(k) + ", ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment