Probability of getting a duplicate value when calling GetHashCode() on strings

前端 未结 6 1463
遥遥无期
遥遥无期 2020-11-30 10:49

I want to know the probability of getting duplicate values when calling the GetHashCode() method on string instances. For instance, according to th

6条回答
  •  有刺的猬
    2020-11-30 11:41

    The probability of a collision between two randomly chosen strings is 1 / 2^(bits in hash code), if the hash is perfect, which is unlikely or impossible.

提交回复
热议问题