Skip to content

Instantly share code, notes, and snippets.

@treejamie
Created May 23, 2013 14:01
Show Gist options
  • Save treejamie/5636287 to your computer and use it in GitHub Desktop.
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.
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