Skip to content

Instantly share code, notes, and snippets.

@ashkanRmk
Created January 3, 2019 18:17
Show Gist options
  • Select an option

  • Save ashkanRmk/1970a7bf6f05a177386bfb2d5090cca0 to your computer and use it in GitHub Desktop.

Select an option

Save ashkanRmk/1970a7bf6f05a177386bfb2d5090cca0 to your computer and use it in GitHub Desktop.
small script make random unique string with define length
import uuid
size = 10000000 #number of uniqe strings
length = 5 #length of generated strings
filename = "result.txt" #name of result file
temp = []
print("START...")
with open(filename, 'w') as f:
while size > 0:
ch = uuid.uuid4().hex[:length]
if (ch not in temp):
f.write(ch + '\n')
temp.append(ch)
size = size - 1
print()
print("Done ^_^ ...")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment