Skip to content

Instantly share code, notes, and snippets.

@hayduke19us
Created September 25, 2013 02:22
Show Gist options
  • Save hayduke19us/6694406 to your computer and use it in GitHub Desktop.
Save hayduke19us/6694406 to your computer and use it in GitHub Desktop.
def shuffle sorted_array, unsorted_array
counter = sorted_array.count - 1
rand_number = (rand(counter))
temp = sorted_array[rand_number]
sorted_array.delete_at(rand_number)
unsorted_array << temp
if sorted_array.count >= 1
shuffle sorted_array,unsorted_array
else
puts unsorted_array
end
end
lett = %w[a b c d e f g h i j]
shuffle lett, []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment