Class: Clandestine::PasswordGenerator
- Inherits:
-
Object
- Object
- Clandestine::PasswordGenerator
- Defined in:
- lib/clandestine/password_generator.rb
Constant Summary collapse
- LETTERS =
('a'..'z').to_a + ('A'..'Z').to_a
- NUMS =
('0'..'9').to_a * 5
- CHARS =
['!', '@', '#', '$', '%', '^', '&', '*', '(', ')'] * 5
Class Method Summary collapse
Class Method Details
.random_password ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/clandestine/password_generator.rb', line 7 def self.random_password password = '' generator = Random.new(Random.srand) chars = LETTERS + NUMS + CHARS chars.shuffle! 12.times do |n| password << chars[generator.rand(0..chars.size - 1)] end password end |