Skip to content

Instantly share code, notes, and snippets.

@bcicen
Created July 5, 2014 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcicen/b016f07a7b501c8243d7 to your computer and use it in GitHub Desktop.
Save bcicen/b016f07a7b501c8243d7 to your computer and use it in GitHub Desktop.
import random
ranges = [
32767,
2147483647,
9223372036854775807,
]
for range in ranges:
print('generating integers in range 0-%i') % range
count = 0
cur_rand = 0
last_rand = 1
while cur_rand != last_rand:
last_rand = cur_rand
cur_rand = (random.randint(0,range) % 100000)
count += 1
print('found sequential random collision after %i iterations') % (count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment