为什么在ConcurrentHashMap中使用0.5作为泊松分布的参数?

时间:2019-03-20 03:48:29

标签: java concurrenthashmap

根据ConcurrentHashMap中的Java文档:

 * Ideally, the frequency of nodes in bins follows a Poisson distribution
 * (http://en.wikipedia.org/wiki/Poisson_distribution) with a
 * parameter of about 0.5 on average, given the resizing threshold
 * of 0.75, although with a large variance because of resizing
 * granularity. Ignoring variance, the expected occurrences of
 * list size k are (exp(-0.5) * pow(0.5, k) / factorial(k)). The
 * first values are:

问题是:0.5参数是怎么来的?

1 个答案:

答案 0 :(得分:0)

我认为我得到0.5的原因: 最大元素计数为0.75 * bin[].length,则将调整垃圾箱的大小。 因此,假设元素数为0.5 * bin[].length,则每个垃圾箱的平均元素数为0.5。