murmurhash算法_MurmurHash与随机数

murmurhash算法_MurmurHash与随机数unsignedintmurMurHash(constvoid*key,intlen){constunsignedintm=0x5bd1e995;constintr=24;constintseed=97;unsignedinth=seed^len;//Mix4bytesatatimeintothehashconstunsigne…


Jetbrains全系列IDE稳定放心使用

unsigned int murMurHash(const void *key, int len)

{

const unsigned int m = 0x5bd1e995;

const int r = 24;

const int seed = 97;

unsigned int h = seed ^ len;

// Mix 4 bytes at a time into the hash

const unsigned char *data = (const unsigned char *)key;

while(len >= 4)

{

unsigned int k = *(unsigned int *)data;

k *= m;

k ^= k >> r;

k *= m;

h *= m;

h ^= k;

data += 4;

len -= 4;

}

// Handle the last few bytes of the input array

switch(len)

{

case 3: h ^= data[2] << 16;

case 2: h ^= data[1] << 8;

case 1: h ^= data[0];

h *= m;

};

// Do a few final mixes of the hash to ensure the last few

// bytes are well-incorporated.

h ^= h >> 13;

h *= m;

h ^= h >> 15;

return h;

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/180554.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长

相关推荐

  • 2013成都邀请赛J称号||HDU4725 The Shortest Path in Nya Graph(spfa+slf最短的优化)

    2013成都邀请赛J称号||HDU4725 The Shortest Path in Nya Graph(spfa+slf最短的优化)

    2022年1月3日
  • epplus word html,EPPlus简介

    epplus word html,EPPlus简介简介:Epplus是一个使用OpenOfficeXML(Xlsx)文件格式,能读写Excel2007/2010文件的开源组件功效:支持对excel文档的汇入汇出,图表(excel自带的图表基本都可以实现)的列印使用:首先应该下载Epplus的dll文件1.添加dll文件至工程bin文件中2.添加引用usingOfficeOpenXml;usingOfficeOpenXml.Drawing…

    2022年6月30日
  • python—最大公约数和最小公倍数

    python—最大公约数和最小公倍数最大公约数defhcf(x,y): ifx<=0ory<=0: return res=0 ifx>y: small=y else: small=x foriinrange(1,small+1): ifx%i==0andy%i==0: res=iif__name__==’__main__’: print(hcf(12,24)) #内置模块importmathmath.

    2022年5月16日
  • arp内网攻击_外网和内网怎么设置

    arp内网攻击_外网和内网怎么设置arpspoof是一款进行arp欺骗的工具,攻击者通过毒化受害者arp缓存,将网关mac替换为攻击者mac,然后攻击者可截获受害者发送和收到的数据包,可获取受害者账户、密码等相关敏感信息。本次测试是在局域网内进行,利用kali截获centos相关数据攻击者ip:192.168.157.129受害者ip:192.168.157.2501、在kali中开启端口转发功能:echo…

    2022年10月7日
  • vscode中搭建Golang开发环境(图文并茂)

    vscode中搭建Golang开发环境(图文并茂)vscode中搭建Golang开发环境第一步下载Go安装包,地址:Go语言中文网,安装完成后的目录如下:通过命令行查看当前版本:第二步配置环境变量,新建两个环境变量,如下:其他平台的配置,可以参考goproxy官网。第三步打开vscode,安装一个Go插件,如下:然后打开一个已有的文件夹,并创建一个hello.go的文件,此时,右下角会提示你要安装相应的应用,选择InstallAll,等待安装即可,安装成功如下:到这里环境就搭建完成了第四步在hello.go文件中编写

    2022年10月12日
  • 秒懂JSONArray和JSONObject的区别和使用

    秒懂JSONArray和JSONObject的区别和使用一.JSONObject是什么?就是对象json;之前在秒懂json中说过,{}表示对象,所以JSONObject就是:{"name":"tom"}同时,这里的对象Json通过添加数组json可以变成对象数组json:{"name":["tome","kate"]}例如:JSONObjectjsono=newJSONObject();JSONArray jsona=…

    2022年6月7日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号