Included here is a standalone, java implementation of Cuckoo Hashing and of a Bloom Filter.
Instructions for using these classes can be found in the Javadocs for Cuckoo hashing or in the instructions for using a Bloom Filter. Source code is also available.
I’m curious about your pseudo-random hash function:
Random r = new Random( objectToHash.hashCode());
int result = r.nextInt(maxBits);
int round = 1;
while( round
Looks like wordpress ate my comment. I’ll try again.
The added rounds don’t seem to do much to mix the hash value, they just replace the result with the next call to nextInt(). Did you intent this, or should it looks something like:
result ^= r.nextInt(maxBits);
actually, that whole hash function looks off. i suspect it was intended to do something more like
result ^= r.nextInt(1
well, the angle brackets were eaten, but i was wrong in any event.
Eh? That is a Cuckoo hash set, not a hash table.
interesting posts on this topic with code examples
http://blog.griddynamics.com/2011/03/ultimate-sets-and-maps-for-java-part-i.html
http://blog.griddynamics.com/2011/03/ultimate-sets-and-maps-for-java-part-ii.html