in reply to Re^4: Get the order of HTTP request headers
in thread Get the order of HTTP request headers

A simple question: Are the results of your example predictable for any combination of hash keys without knowing the hash seed?

  • Comment on Re^5: Get the order of HTTP request headers

Replies are listed 'Best First'.
Re^6: Get the order of HTTP request headers
by ikegami (Patriarch) on May 06, 2010 at 18:58 UTC

    Yes.

    Without knowing the seed or the hashing algorithm, I correctly predicted 99% of the results the first time I ran the program, and I correctly predicted 100% results the second time I ran the program.

    The hash was never reseeded since the pathological case was never encountered.

    In a more casual sense, the order is unpredictable. It just hasn't been shown to be random. Even if the hash had been reseeded.

      Let's just say that randomness lies in the eye of the beholder and call it a day.

        If something is random, the odds of an outcome occurring is equal to the odds of each other outcome occurring. Something can be unpredictable without being random.

        Without a doubt, the order of the values returned by keys(%ENV) is unpredictable.