how to randomize List::Util::shuffle() better?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Quoted text here. Click to load it

Repair the corrupted file:

   perl -p -i -e 'tr/\r//d' bad_file

    Tad McClellan                          SGML consulting                   Perl programming
    Fort Worth, Texas

Re: how to randomize List::Util::shuffle() better?

Nomen Nescio ( wrote on MMMMCDXIX September MCMXCIII in
..  I want to pick three things at random from a list, so:
..  use List::Util 'shuffle';
..  ..
..  sub pick {
..      my @items = shuffle(@_);
..      return join(",", @items[0,1,2]);
..  }
..  but every time I call this (repeatedly within the same run) with the
..   same input list, I get the same three items back out.

Really? Do you have a *complete* program (not longer than about 20 lines)
that shows this behaviour?

..  Is there any way to randomize shuffle more?

No. There are things you can do to make it *less* random, like resetting
the random seed. Are you sure you aren't calling srand before each call
to pick()?

perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'

Site Timeline