murmurhash算法_MurmurHash与随机数

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

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 安装luajit_lua安卓

    安装luajit_lua安卓wgethttp://luajit.org/download/LuaJIT-2.0.5.tar.gztarxzvfLuaJIT-2.0.5.tar.gzcdLuaJIT-2.0.5mkdir~/luajit2makeprefix=/home/wang/luajit2sudomakeinstallluajit-v#SuccessfullyLuaJIT2.0.5…

    2022年9月26日
    0
  • 游戏开发经验谈(一):游戏架构里隐藏的五个坑及其应对方案

    游戏开发经验谈(一):游戏架构里隐藏的五个坑及其应对方案

    2021年6月10日
    100
  • JAVA生成uuid_oracle uuid生成

    JAVA生成uuid_oracle uuid生成packagetest.demo1;importjava.util.UUID;publicclassUUIDUtil{ publicstaticStringcreatUUID(){ returnUUID.randomUUID().toString().replace(“-“,””); } publicstaticvoidmain(String[]

    2022年9月16日
    0
  • linux如何卸载eclipse(eclipse工具linux版本)

    1.安装JDK6先确认已经添加了软件源,在系统-系统管理-软件源-其它软件,确保已经选中http://archive.canonical.com/ubuntulucidpartner这个源。sudoapt-getinstallsun-java6-jdk设置系统环境变量exportJAVA_HOME=/usr/lib/jvm/java-6-sun(根据具体的安装路径)expor…

    2022年4月17日
    87
  • kafka和rabbitmq和activemq区别_kafka消息持久化处理

    kafka和rabbitmq和activemq区别_kafka消息持久化处理一、语言不同RabbitMQ是由内在高并发的erlanng语言开发,用在实时的对可靠性要求比较高的消息传递上。kafka是采用Scala语言开发,它主要用于处理活跃的流式数据,大数据量的数据处理上二、结构不同RabbitMQ采用AMQP(AdvancedMessageQueuingProtocol,高级消息队列协议)是一个进程间传递异步消息的网络协议RabbitMQ…

    2022年10月28日
    0
  • 五大经典算法总结

    五大经典算法总结    马上要开始投简历找实习了,自己还是毛都不会,慌得一笔,从今天开始每天刷2道以上的leetcode然后总结,并且总结各种面试题的知识点,以后常复习,加油。    在刷leetcode时经常看到有人说DP,然后去百度了DP是个啥,才知道DP是五大经典算法之一,今天开始总结一下五大经典算法。    五大经典算法分为1、分治法:把一个复杂的问题分成两个或更多的相同或相似的子问…

    2022年5月18日
    43

发表回复

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

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