Module: PasswordGenerator
- Defined in:
- lib/peatio/ripple/password_generator.rb
Overview
PasswordGenerator
Usage
>> PasswordGenerator.generate
> “2pN@cxj+zs!SVogtPZ&u”
>> PasswordGenerator.generate(40)
> “B5xPy2unMKjRchfS($7v)q4N%oF*lGz@+OJ6LbVD”
Constant Summary collapse
- CHARS =
('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a + %w{! @ # $ % & / ( ) + ? *}
Class Method Summary collapse
Class Method Details
.generate(length = 20) ⇒ Object
17 18 19 |
# File 'lib/peatio/ripple/password_generator.rb', line 17 def generate(length = 20) CHARS.sort_by { rand }.join[0...length] end |