End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
SecureRandom.gen_random
gen_random(n)
lib/securerandom.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/securerandom.rb, line 63
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
Alias of .gen_random_urandom