You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
184 B
Ruby

def shuffle_array_in_place(arr)
len = arr.length
(0...len).each do |n|
rand_int = rand(n..len)
arr[n], arr[rand_int] = arr[rand_int], arr[n]
end
arr
end