Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Deterministic or keys in random order

by mscharrer (Hermit)
on May 14, 2008 at 14:26 UTC ( #686529=note: print w/replies, xml ) Need Help??


in reply to Deterministic or keys in random order

The above posts give good explanations already, I just like to add the following:
For the above given hash I get the following constant order of keys:

Zero Two One

I think the reason for your "constant"/"deterministic" behavior is that your test hash is very very small so that there aren't much different ways to order the keys. It's just by chance that the first given key is the first returned. As soon you have more keys a different key is the first returned.

Replies are listed 'Best First'.
Re^2: Deterministic or keys in random order
by almut (Canon) on May 14, 2008 at 14:43 UTC
    ... As soon you have more keys a different key is the first returned.

    don't think so (tried it with quite a number of keys — for each set of keys, the pseudorandom order obtained is replicably the same)...  But demerphq seems to have the explanation (in the thread already referenced above).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://686529]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2022-12-10 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?