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

Re: randomly choosing elements from an array

by domm (Chaplain)
on Mar 19, 2003 at 08:59 UTC ( #244288=note: print w/ replies, xml ) Need Help??

in reply to randomly choosing elements from an array

What about shuffling the array using one of the shuffle functions in either List::Util or Algorithm::Numerical::Shuffle and then shifting off the desired number (or a random number) of elements?

-- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

Comment on Re: randomly choosing elements from an array
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2016-02-11 04:40 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (359 votes), past polls