Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Pick random element from array and delete it

by Ratazong (Prior)
on Jul 17, 2012 at 08:16 UTC ( #982174=note: print w/ replies, xml ) Need Help??


in reply to Pick random element from array and delete it

I dont think I can use splice here as I dont know the index of the random element I just picked...

If you are comfortable with a splice-solution, you may change the way you select your random element: just select a random index (instead of the element itself.)

HTH, Rata


Comment on Re: Pick random element from array and delete it

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2015-07-05 20:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls