Guest User

Untitled

a guest
Jan 4th, 2024
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. import os
  2. import itertools
  3.  
  4. def test():
  5.     hashes = set()
  6.     for i in itertools.count():
  7.         # generate 2 bytes = 16 bits of randomness, twice
  8.         a = os.urandom(2)
  9.         if a in hashes:
  10.             return i
  11.         else:
  12.             hashes.add(a)
  13.  
  14. for i in range(100):
  15.     print(test())
Advertisement
Add Comment
Please, Sign In to add comment