mirror of
https://github.com/gotoeasy/glogcenter.git
synced 2025-09-15 12:58:34 +08:00
散列取模增加参数
This commit is contained in:
parent
c13ee8216a
commit
1df8f3da7c
@ -121,8 +121,8 @@ func PathSeparator() string {
|
||||
}
|
||||
|
||||
// 字符串哈希处理后取模(余数),返回值最大不超过mod值
|
||||
func HashAndMod(str string, mod uint32) string {
|
||||
txt := "添油" + str + "加醋"
|
||||
func HashAndMod(str string, mod uint32, prefix string) string {
|
||||
txt := prefix + "_" + str
|
||||
return fmt.Sprint(crc32.ChecksumIEEE(StringToBytes(txt)) % mod)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user