mirror of
https://github.com/python/cpython.git
synced 2025-09-22 16:33:26 +00:00
test_hash(): The test here is different enough from the one in the bug
report that the stats for expected # of collisions are a little higher. Updated comments accordingly.
This commit is contained in:
parent
7897ff0d9a
commit
1f4bcf9edd
1 changed files with 7 additions and 3 deletions
|
@ -49,9 +49,13 @@ class TupleTest(seq_tests.CommonTest):
|
||||||
# should not exhibit cancellation in tuples like (x,(x,y))
|
# should not exhibit cancellation in tuples like (x,(x,y))
|
||||||
# should be distinct from element hashes: hash(x)!=hash((x,))
|
# should be distinct from element hashes: hash(x)!=hash((x,))
|
||||||
# This test exercises those cases.
|
# This test exercises those cases.
|
||||||
# For a pure random hash and N=50, the expected number of collisions
|
# For a pure random hash and N=50, the expected number of occupied
|
||||||
# is 7.3. Here we allow twice that number.
|
# buckets when tossing 252,600 balls into 2**32 buckets
|
||||||
# Any worse and the hash function is sorely suspect.
|
# is 252,592.6, or about 7.4 expected collisions. The
|
||||||
|
# standard deviation is 2.73. On a box with 64-bit hash
|
||||||
|
# codes, no collisions are expected. Here we accept no
|
||||||
|
# more than 15 collisions. Any worse and the hash function
|
||||||
|
# is sorely suspect.
|
||||||
|
|
||||||
N=50
|
N=50
|
||||||
base = range(N)
|
base = range(N)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue