Created
August 16, 2020 20:10
-
-
Save bitaxis/8521baea1805cfc23d658f594da37ca7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
password_length = (ARGV[0] || 16).to_i | |
symbol_count = (ARGV[1] || 2).to_i | |
alphanumerics = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a | |
symbols = "~`!@##$%^&-=_+()[]{};:,.".chars | |
50.times do | |
password = password_length.times.collect { alphanumerics[Random.rand(0...alphanumerics.length)] }.join | |
symbol_count.times { password[Random.rand(0...password.length)] = symbols[Random.rand(0...symbols.length)] } | |
puts password | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment