Method: JSON::Util::UUID.create_random
- Defined in:
- lib/json-schema/util/uuid.rb
.create_random ⇒ Object Also known as: create_v4
UUID generation using random-number generator. From it’s random nature, there’s no warranty that the created ID is really universaly unique.
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/json-schema/util/uuid.rb', line 105 def create_random rnd = [ rand(0x100000000), rand(0x100000000), rand(0x100000000), rand(0x100000000), ].pack 'N4' raw = mask 4, rnd ret = new raw ret.freeze ret end |