Skip to content

Instantly share code, notes, and snippets.

@glennpratt
Created June 20, 2011 18:18
Show Gist options
  • Select an option

  • Save glennpratt/1036203 to your computer and use it in GitHub Desktop.

Select an option

Save glennpratt/1036203 to your computer and use it in GitHub Desktop.
# Generate a password meeting policy standards.
pass = ((0...8).map{ (('a'..'z').to_a + ('A'..'Z').to_a + ('2'..'9').to_a)[rand(60)] } + (0...2).map{ (('a'..'z').to_a)[rand(26)] } + (0...2).map{ (('A'..'Z').to_a)[rand(26)] } + (0...2).map{ (('2'..'9').to_a)[rand(8)] } + (0...2).map{ (['!','$','&','@'])[rand(4)] }).shuffle.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment