We don't bite newbies here... much | |
PerlMonks |
Re^7: RFC: Is there a solution to the flaw in my hash mechanism? ($o != $i)by tye (Sage) |
on Jun 03, 2015 at 06:38 UTC ( [id://1128915]=note: print w/replies, xml ) | Need Help?? |
And sorry I misunderstood you. No problem. My concern was just that my contribution might be helpful but for some extra explanation. No offense taken. is effectively the same as ... $i ||= 1 Except that it distributes rather more evenly. which would basically mean either reducing the possible range of inputs (exclude 2**64-1 for example), or use the spill array for that other value I'm not convinced that either of those is required. But I'll refrain from trying to make a case stronger than that at least at this point. But it isn't hard to adjust the approach if using all but one (particular) slot until the hash is completely filled is somehow unacceptable. Actually, a nearly trivial adjustment has what can be a significant advantage in that it can reduce the collisions because different hash values that start at the same insertion point will likely follow different paths for subsequent insertion points.
Thank you. You are most welcome, of course. - tye
In Section
Seekers of Perl Wisdom
|
|