Skip to content

Instantly share code, notes, and snippets.

@EricDykstra
Created March 13, 2013 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EricDykstra/5149038 to your computer and use it in GitHub Desktop.
Save EricDykstra/5149038 to your computer and use it in GitHub Desktop.
Shuffler
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