Created
January 3, 2019 18:17
-
-
Save ashkanRmk/1970a7bf6f05a177386bfb2d5090cca0 to your computer and use it in GitHub Desktop.
small script make random unique string with define length
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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