summaryrefslogtreecommitdiff
path: root/lib/securerandom.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/securerandom.rb')
-rw-r--r--lib/securerandom.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index 81757f3100..6079fdb5c4 100644
--- a/lib/securerandom.rb
+++ b/lib/securerandom.rb
@@ -41,7 +41,7 @@ require 'random/formatter'
module SecureRandom
# The version
- VERSION = "0.3.1"
+ VERSION = "0.4.1"
class << self
# Returns a random binary string containing +size+ bytes.
@@ -51,6 +51,12 @@ module SecureRandom
return gen_random(n)
end
+ # Compatibility methods for Ruby 3.2, we can remove this after dropping to support Ruby 3.2
+ def alphanumeric(n = nil, chars: ALPHANUMERIC)
+ n = 16 if n.nil?
+ choose(chars, n)
+ end if RUBY_VERSION < '3.3'
+
private
# :stopdoc: