Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/securerandom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def bytes(n)
# 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?
size = chars.size
raise ArgumentError, "character length must not be negative" if 0 > n
raise ArgumentError, "character source must contain at least two entries" if size < 2
choose(chars, n)
end if RUBY_VERSION < '3.3'

Expand Down