Skip to content

Instantly share code, notes, and snippets.

@olistik
Created December 22, 2010 09:25
Show Gist options
  • Select an option

  • Save olistik/751306 to your computer and use it in GitHub Desktop.

Select an option

Save olistik/751306 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
dictionary = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
password = 1.upto(10).map {|i|
index = (rand * dictionary.size).to_i
dictionary[index]
}.join
puts "random password: #{password}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment