Created
March 13, 2013 02:54
-
-
Save EricDykstra/5149038 to your computer and use it in GitHub Desktop.
Shuffler
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 better_shuffle(array) | |
shuffled_array = [] | |
until array.length == 0 | |
rand_num = rand(array.length - 1) | |
shuffled_array << array.delete_at(rand_num) | |
end | |
return shuffled_array | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment