选择一个乘法器,用于一(串)的散列函数 [英] Choosing a multiplier for a (string) hash function

查看:111
本文介绍了选择一个乘法器,用于一(串)的散列函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你有关于选择乘数(乘)散列函数中使用任何建议/规则。该函数的计算串的哈希值

Do you have any advice/rules on selecting a multiplier to use in a (multiplicative) hash function. The function is computing the hash value of a string.

推荐答案

您要使用的东西是互质到您所设定的大小。这样,当你周围的循环,你最终不会对你只是尝试了相同的数字。

You want to use something that is relatively prime to the size of your set. That way, when you loop around, you won't end up on the same numbers you just tried.

这篇关于选择一个乘法器,用于一(串)的散列函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆