Skip to content

Instantly share code, notes, and snippets.

@sergiomaia
Created May 26, 2012 13:42
Show Gist options
  • Save sergiomaia/2794004 to your computer and use it in GitHub Desktop.
Save sergiomaia/2794004 to your computer and use it in GitHub Desktop.
Random Passwords
#acho que da pra fazer assim, veja se funciona.
class RandomPasswords
def generate(size = 8)
chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('1'..'9').to_a
(1..size).collect {|c| chars[ rand(chars.size) ]}.join
end
end
#nesse caso uma senha com 8 caracteres, se precisar ser maior ou menor mude o parâmetro ... dohhhh!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment