module Bundler::SecureRandom
def alphanumeric(n = nil, chars: ALPHANUMERIC)
def alphanumeric(n = nil, chars: ALPHANUMERIC) n = 16 if n.nil? choose(chars, n) end if RUBY_VERSION < '3.3'
def bytes(n)
Returns a random binary string containing +size+ bytes.
def bytes(n) return gen_random(n) end
def gen_random_openssl(n)
def gen_random_openssl(n) return OpenSSL::Random.random_bytes(n) end
def gen_random_urandom(n)
def gen_random_urandom(n) ret = Random.urandom(n) unless ret raise NotImplementedError, "No random device" end unless ret.length == n raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes" end ret end