method
uuid
v2_6_3 -
Show latest stable
-
0 notes -
Class: Formatter
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6 (0)
- 2_5_5 (-38)
- 2_6_3 (1)
- What's this?
uuid()
public
SecureRandom.uuid generates a random v4 UUID (Universally Unique IDentifier).
require 'securerandom' SecureRandom.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594" SecureRandom.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab" SecureRandom.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b"
The version 4 UUID is purely random (except the version). It doesn’t contain meaningful information such as MAC addresses, timestamps, etc.
The result contains 122 random bits (15.25 random bytes).
See RFC 4122 for details of UUID.