I was reading about Java's approach to randomize hash keys here
Apparently the idea is to make sure that the lower bits are "random" to help the distribution but I am trying to understand this more.
So if we have a table of size 10 then the numbers 0,10,20,30,40 etc all fall in bucket 0, the numbers 1,11,21,31 etc fall in bucket 1 etc (using modulo 10).
So changing the bit patterns you could make these go to different buckets instead of all going to bucket 0.
But what I am not clear about is what property is it that makes the low order bits affect this and we need to randomize them.
So we have:
0000 0000 (0)
0000 1010 (10)
0001 0100 (20)
0001 1110 (30)
0010 1000 (40)
What is the regularity in the low order bits that makes them placed to the same slot?
Perhaps I am confused on the following? My understanding is that it is some regularity in low order bits that cause collisions and we try to randomize bit to compensate
..but for hash implementations where the number of buckets is always a power of 2, the fact that all the hashes are divisible by 8 would mean that most buckets were empty.
What is 8? The size of the address? And why does it happen for size of power of 2? Could you please elaborate a bit on this? – Alb