Here you can find the source of murmurRehash(final int hash)
Parameter | Description |
---|---|
hash | bad quality hash |
public static int murmurRehash(final int hash)
//package com.java2s; /**/* w w w . jav a 2s. co m*/ * Copyright (C) 2011-2012 Andrey Borisov <aandrey.borisov@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { /** * re-hashes a 4-byte sequence (Java int) using murmur3 hash algorithm.</p> * * @param hash * bad quality hash * @return good general purpose hash */ public static int murmurRehash(final int hash) { int k = hash; k ^= k >>> 16; k *= 0x85ebca6b; k ^= k >>> 13; k *= 0xc2b2ae35; k ^= k >>> 16; return k; } }