Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
SecureRandom.alphanumeric
(?::Numeric?, ?chars: ::Array[::String]) -> ::String
alphanumeric(n = nil, chars: ALPHANUMERIC)
lib/securerandom.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/securerandom.rb, line 54
def alphanumeric(n = nil, chars: ALPHANUMERIC)
n = 16 if n.nil?
choose(chars, n)
end
Compatibility methods for Ruby 3.2, we can remove this after dropping to support Ruby 3.2