It may be more efficient to generate a string with 10 random characters, or use a random number generator, rather than sorting a huge array randomly. http://api.rubyonrails.org/v3.0.9/classes/ActiveSupport/SecureRandom.html#method-c-random_number is a nice method.