The following is a collection of hash functions for integers.
Does not work too well with integers that are multiples of .
unsigned int TWHash(unsigned int a) { a = (a ^ 61) ^ (a >> 16); a = a + (a << 3); a = a ^ (a >> 4); a = a * 0x27d4eb2d; a = a ^ (a >> 15); return a; }
private static int JavaHash(int h) { // This function ensures that hashCodes that differ only by // constant multiples at each bit position have a bounded // number of collisions (approximately 8 at default load factor). h ^= (h >> > 20) ^ (h >> > 12); return h ^ (h >> > 7) ^ (h >> > 4); }