Beautiful Code: Generate strong passwords using one line of Ruby
This line of ruby code lets you generate strong passwords, using most of the ASCII codes.
[code lang=”ruby”]
((33..126).map { |i| i.chr }).to_a.shuffle[0..14].join
[/code]
- The (33..126) bit lets you use lowercase, UPPERCASE and symbols for your password.
- The [0..14] indicates passwords should be 14 characters long. Feel free to change 14 to whatever you need.
Thanks to Michael Hartl (Ruby on Rails Tutorial: Learn Rails by Example) for the inspiration.

