I want to know if there is a much cleaner way of doing this. Basically, I want to pick a random element from an array of variable length. Normally, I would do it like this:
myArray = ["stuff", "widget", "ruby", "goodies", "java", "emerald", "etc" ] item = myArray[rand(myarray.length)]
Is there something that is more readable / simpler to replace the second line? Or is that the best way to do it. I suppose you could do
myArray.shuffle.first, but I only saw
#shuffle a few minutes ago on SO, I haven't actually used it yet.