Skip to content

Commit

Permalink
doc++
Browse files Browse the repository at this point in the history
  • Loading branch information
sthalik committed Jun 9, 2024
1 parent 62ed07f commit 0f16210
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/hash-birthday-paradox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python
import math
N = 2**16
probUnique = 1.0
for k in range(1, 10_000):
val = 1 - math.exp(-0.5 * k * (k - 1) / N)
# probAllUnique = probUnique * (N - (k - 1)) / N
#print(k, 1 - probAllUnique, val)
print(k, val)
if val + 1e-12 > 1:
break

0 comments on commit 0f16210

Please sign in to comment.