Skip to content

Instantly share code, notes, and snippets.

@stengland
Created April 23, 2013 12:41
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 stengland/5443247 to your computer and use it in GitHub Desktop.
Save stengland/5443247 to your computer and use it in GitHub Desktop.
def temp_password
@temp_password ||= ((0..9).to_a.sample(2) + ('a'..'z').to_a.sample(6)).shuffle.join
end
@alexslade
Copy link

I quite like using SecureRandom for short random passwords/tokens

SecureRandom.urlsafe_base64(6)
# => "dhMvT3_e"

randomcommentswooo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment