summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
-rw-r--r--lib/random/formatter.rb13
1 files changed, 10 insertions, 3 deletions
@@ -226,11 +226,13 @@ module Random::Formatter
#
# The argument _n_ specifies the length, in characters, of the alphanumeric
# string to be generated.
#
# If _n_ is not specified or is nil, 16 is assumed.
# It may be larger in the future.
#
- # The result may contain A-Z, a-z and 0-9.
#
# require 'random/formatter'
#
@@ -238,8 +240,13 @@ module Random::Formatter
# # or
# prng = Random.new
# prng.alphanumeric(10) #=> "i6K93NdqiH"
- def alphanumeric(n=nil)
n = 16 if n.nil?
- choose(ALPHANUMERIC, n)
end
end