Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
go ahead... be a heretic
 
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 cooling their heels in the Monastery: (4)
As of 2014-04-21 05:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (491 votes), past polls