You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Module: SecureRandom

Defined in:
lib/aws/core.rb

Class Method Summary collapse

Class Method Details

.uuidObject



688
689
690
691
692
693
# File 'lib/aws/core.rb', line 688

def self.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