Last active
December 30, 2015 18:13
-
-
Save dylwylie/a73555686b6da3dd8873 to your computer and use it in GitHub Desktop.
Uses pythons uuid library to generated uuids to see if they generate collisions. (Warning: Will use up your RAM)
This file contains 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 | |
count = 0 | |
collision = False | |
guid_dict = {} | |
while not collision: | |
guid = uuid.uuid4() | |
if not guid in guid_dict: | |
guid_dict[guid] = 1 | |
else: | |
collision = True | |
print("Collision found!") | |
print("Collision found after " + str(count) + " loops") | |
print("Key: " + str(guid)) | |
if count % 1000000 == 0: | |
print(str(count) + " Counts and no collision") | |
count = count + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment