假设您要散列的数字具有均匀分布,则您的函数偏向于桶 0 到 12。
假设发生了直到并包括该mod 313
操作的散列操作。该操作的结果为您提供 0..312 范围内的值。再次,如果这个操作的结果是均匀分布的,那么mod 100
你得到以下效果:
result of Occurs for these
mod 100 mod 313 results
----------- ------------------
0 0, 100, 200, 300
1 1, 101, 201, 301
2 2, 102, 202, 302
3 3, 103, 203, 303
4 4, 104, 204, 304
5 5, 105, 205, 305
6 6, 106, 206, 306
7 7, 107, 207, 307
8 8, 108, 208, 308
9 9, 109, 209, 309
10 10, 110, 210, 310
11 11, 111, 211, 311
12 12, 112, 212, 312
13 13, 113, 213
14 14, 114, 214
15 15, 115, 215
请注意在 12 点之后获得特定结果的机会数量如何下降?有你的偏见。以下是对数字 0 到 5,000,000 的散列结果的计算结果的更多证据:
counts[0]: 63898
counts[1]: 63896
counts[2]: 63899
counts[3]: 63900
counts[4]: 63896
counts[5]: 63896
counts[6]: 63900
counts[7]: 63896
counts[8]: 63896
counts[9]: 63900
counts[10]: 63898
counts[11]: 63896
counts[12]: 63899
counts[13]: 47925
counts[14]: 47922
counts[15]: 47922
counts[16]: 47925
... elided similar counts ...
counts[97]: 47922
counts[98]: 47922
counts[99]: 47925