Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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$_.$/}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://244288]
help
Chatterbox?
[LanX]: YT=youtube
[Discipulus]: ;=) yes i'm not SO dumb
[LanX]: SO=StackOverflow
[Discipulus]: :=(
[perldigious]: I watched some video on YT awhile back with auto-subtitle on and the speaker had a very thick cockney sort of English accent... hillarity ensued in the subtitles.
[Discipulus]: IHAA=I hate acronyms anyway
LanX LOLs

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2017-06-23 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (552 votes). Check out past polls.