Created
September 25, 2013 02:22
-
-
Save hayduke19us/6694406 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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