diff options
author | Blake Imsland <[email protected]> | 2022-03-13 23:27:46 -0700 |
---|---|---|
committer | git <[email protected]> | 2023-12-29 02:43:45 +0000 |
commit | e86b4c29fc91fa510ee2cf3f5e3296a9a66affb5 () | |
tree | f1a8ea39866327a228684d66be7eb278315e6588 | |
parent | 2b96737636e1c96fedda83895ef32e19a914e310 (diff) |
[ruby/securerandom] Increase speed of UUID generation
https://.com/ruby/securerandom/commit/b587b8c7cb
-rw-r--r-- | lib/random/formatter.rb | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -168,10 +168,10 @@ module Random::Formatter # See RFC4122[https://datatracker.ietf.org/doc/html/rfc4122] for details of UUID. # def uuid - ary = random_bytes(16).unpack("NnnnnN") - ary[2] = (ary[2] & 0x0fff) | 0x4000 - ary[3] = (ary[3] & 0x3fff) | 0x8000 - "%08x-%04x-%04x-%04x-%04x%08x" % ary end alias uuid_v4 uuid |