Randomizing Position in an Array

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) }   end

It does randomize it, but it only returns 3 values instead of the necessary 5 that are in the arr_set array. Any ideas why?

Thank you!

Please try: http://www.google.com/search?rls=en&q=array+shuffle+ruby

-Rob

Just to save you a little time:

myarr = [1,2,3,4,5]

=> [1, 2, 3, 4, 5]

myarr.sort_by { rand }

=> [5, 3, 2, 4, 1]

--Jeremy

Very cool, and very useful information. I appreciate everyones help in this!

I did a lot of searching on google, but came up empty, so I am thankful for this help.

My situation isn't extremely time sensitive, but I'm glad to know a simple solution such as the 3rd, or 4th option will work well.