Skip to content

Instantly share code, notes, and snippets.

@stevenwilkin
Created October 6, 2009 11:58
Show Gist options
  • Save stevenwilkin/202949 to your computer and use it in GitHub Desktop.
Save stevenwilkin/202949 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# random_password.rb
# generate a random string of 12 alphanumeric characters
# Steven Wilkin @stevebiscuit
chars = ('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a
12.times {print chars[rand(chars.length)]}
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment