http://qs1969.pair.com?node_id=11129756

rsFalse has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

Is it possible to set fixed hash behavior: getting the same order of keys (or values, or each)?
1. For every same hash in running script.
2. For every same hash between running script several times.

How scripts, output of which depend on hashes, are tested? E.g. once generated desired output, which is suitable for being a test case, won't be the same in the next run?

Comparing to scripts which uses 'rand' one can set the same seed ('srand CONST') for getting the same output every time.

Upd. E.g. I shuffled (10k times) an array with a hash, and got different patterns of shuffling occurrences between different script runs (see from here: Re: RFC: Kinda pseudo-shuffle using sort).