Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > how to randomize List::Util::shuffle() better?

Thread Tools

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

Nomen Nescio
Posts: n/a
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.

Is there any way to randomize shuffle more?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Why wont this Randomize? (Classic VB Script ASP) Badass Scotsman ASP .Net 1 05-05-2006 07:53 PM
randomize character ashu C++ 6 10-18-2005 08:47 PM
own code for randomize Sweety C Programming 2 07-27-2004 08:28 AM
Randomize STL stack Zaphod C++ 3 04-27-2004 02:55 PM