Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Hashes aren't being differently randomized

by shmem (Chancellor)
on Jun 26, 2006 at 18:15 UTC ( [id://557630]=note: print w/replies, xml ) Need Help??


in reply to Re: Hashes aren't being differently randomized
in thread Hashes aren't being differently randomized

This is explicitly stated in perlsec:
Perl has never guaranteed any ordering of the hash keys, and the ordering has already changed several times during the lifetime of Perl 5. Also, the ordering of hash keys has always been, and continues to be, affected by the insertion order.

Also note that while the order of the hash elements might be randomised, this "pseudoordering" should not be used for applications like shuffling a list randomly (use List::Util::shuffle() for that, see List::Util, a standard core module since Perl 5.8.0; or the CPAN module Algorithm::Numerical::Shuffle), or for generating permutations (use e.g. the CPAN modules Algorithm::Permute or Algorithm::FastPermute), or for any cryptographic applications.

greets,
--shmem

_($_=" "x(1<<5)."?\n".qキ/)Oo.  Gー\        /
                              /\_ッ/(q    /
----------------------------  \__(m.====キ.(_("always off the crowd"))."キ
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
  • Comment on Re^2: Hashes aren't being differently randomized

Replies are listed 'Best First'.
Re^3: Hashes aren't being differently randomized
by vkon (Curate) on Jun 26, 2006 at 18:44 UTC
    Your post is good and do not contradicts mine,
    I suspect you intended to reply to OP, isn't it?
      It was meant as an addendum.

      (If I posted to OP, it would have been out of sequence if anybody else would have posted in between. I wanted to elaborate deliberately on perl not guaranteeing neither order nor disorder, as follow-up to your statement you must not pretend ...)

      cheers,
      --shmem

      _($_=" "x(1<<5)."?\n".qテつキ/)Oo.  Gテつー\        /
                                    /\_テつッ/(q    /
      ----------------------------  \__(m.====テつキ.(_("always off the crowd"))."テつキ
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-19 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found