Pick random element from an array and remove it
ruby
Solution
array.delete_at(rand(array.length))
This seems right, and I guess it works best.
EDIT: This same answer is here: Is there a particular function to retrieve then delete random array element? so I'd go with this :D
Problem
I would like to pick an random element from an array, remove it from the array, and then return the element. I can use `sample` to get an element, `index` to find where it is, and then `delete_at` to remove it, but is there a better way?