Sha256: 1d075e772e1323e7c0e98743d3e2ee1c185db730e95f04f6369453f8db771de7
Contents?: true
Size: 737 Bytes
Versions: 6
Compression:
Stored size: 737 Bytes
Contents
# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details. module NewRelic module Agent module GuidGenerator module_function # This method intentionally does not use SecureRandom, because it relies # on urandom, which raises an exception in MRI when the interpreter runs # out of allocated file descriptors. # The guids generated by this method may not be _secure_, but they are # random enough for our purposes. def generate_guid length = 16 guid = rand(16**length).to_s(16) guid.length < length ? guid.rjust(length, "0") : guid end end end end
Version data entries
6 entries across 6 versions & 1 rubygems