git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-04-26 15:47:24 +00:00
Родитель d0a4f8ada9
Коммит ebd2090d29
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -230,7 +230,11 @@ module SecureRandom
# p SecureRandom.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
# p SecureRandom.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b"
#
# See RFC 4122 for UUID.
# The version 4 UUID is purely random (except the version).
# It doesn't contain meaningful information such as MAC address, time, etc.
#
# See RFC 4122 for details of UUID.
#
def self.uuid
ary = self.random_bytes(16).unpack("NnnnnN")
ary[2] = (ary[2] & 0x0fff) | 0x4000