module Bundler::SecureRandom

def bytes(n)

See Random.bytes

Returns a random binary string containing +size+ bytes.
def bytes(n)
  return gen_random(n)
end

def gen_random_openssl(n)

Implementation using OpenSSL
def gen_random_openssl(n)
  return OpenSSL::Random.random_bytes(n)
end

def gen_random_urandom(n)

Implementation using system random device
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