Class: DataAnon::Utils::RandomString
- Inherits:
-
Object
- Object
- DataAnon::Utils::RandomString
- Defined in:
- lib/utils/random_string.rb
Constant Summary collapse
- RANDOM_STRING_CHARS =
'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789'
Class Method Summary collapse
Class Method Details
.generate(length = nil, chars = RANDOM_STRING_CHARS) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/utils/random_string.rb', line 7 def self.generate length = nil, chars = RANDOM_STRING_CHARS length ||= Random.new.rand 5...15 random_string = '' length.times { random_string << chars[rand(chars.size)] } random_string end |