lib/anybase.rb in anybase-0.0.8 vs lib/anybase.rb in anybase-0.0.9
- old
+ new
@@ -19,9 +19,13 @@
def ignore_case?
@ignore_case
end
+ def size(digits)
+ chars.length ** digits
+ end
+
def random(digits, opts = nil)
zero_pad = opts && opts.key?(:zero_pad) ? opts[:zero_pad] : true
number = ''
digits.times { number << chars[rand(chars.size)]}
unless zero_pad