Created
May 23, 2013 14:01
-
-
Save treejamie/5636287 to your computer and use it in GitHub Desktop.
In an exercise of experimentation I'm seeing if I can get a uuid4 collision in less than 20,000,000.
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 sys | |
import uuid | |
ids = set() | |
try: | |
while True: | |
id = uuid.uuid4() | |
if id in ids: | |
break | |
ids.add(id) | |
l = len(ids) | |
if l % 10000 == 0: | |
print l | |
except KeyboardInterrupt: | |
pass | |
print len(ids) | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment