Skip to content

Instantly share code, notes, and snippets.

@jonaslsaa
Created December 3, 2014 12:09
Show Gist options
  • Save jonaslsaa/070ff2b913f696491b95 to your computer and use it in GitHub Desktop.
Save jonaslsaa/070ff2b913f696491b95 to your computer and use it in GitHub Desktop.
Never the same number generator. VERSION 2
import random as rnd
nu=0
try:
with open("DATA.txt", 'r') as f:
c = [line.rstrip('\n') for line in f]
print "LOADED!"
except IOError:
print "Setting up!"
with open("DATA.txt", 'w') as f:
print "LOADED!"
while nu == 0:
check=rnd.randint(1000,9999)
with open("DATA.txt", 'r') as f:
c = [line.rstrip('\n') for line in f]
if str(check) in c:
print "NEXT"
else:
with open("DATA.txt", 'a') as f:
f.write(str(check)+'\n')
raw_input("Press Enter to show Key! ")
print "\n\n\n\nYour Key: " + str(check)
nu=1
dummie = raw_input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment