|Perl: the Markov chain saw|
|( #3333=superdoc: print w/replies, xml )||Need Help??|
Reviewing the docs and the source I think I can explain what the deal is. Hashes arent "randomized" at all. In fact from what I can tell all perls default to using the exact same hashing at the beginning. But when a hash goes pathological (which appears from the hash testing code to be defined as having twenty keys in a single bucket) then randomization kicks in, on a per hash basis.
I dont know if this behaviour makes sense, or if it matches with how its documented, but that appears to be the way it works.
The code below shows how you can put 10 keys in a single bucket but that twenty will cause the hash to randomize itself. I had to change tyes routine a little as the strings we are dealing with are all zero bytes (which effectively guarantees that they go in the same bucket in a non randomized hash).
I guess you could use this technique to randomize a hash. Stuff it with "\0" x 1 to "\0" x 20 and then empty it and then refill it with what you really want to store in it.
In reply to Re: Hashes aren't being differently randomized (explanation)