Randomizing an Array Help


(sorry if I posted this twice, google groups is not working well, I

I’m trying to randomize an array, and this is what I have:

arr_set_unordered = randomizer(arr_set)

def randomizer(arr)
result = arr.collect { arr.slice!(rand arr.length) }

It does randomize it, but it only returns 3 values instead of the 5
values that I’m expecting. Any ideas why?

Thank you!


a = [1,2,3,4,5]
a.sort_by {rand}
=> 3,1,5,2,4