Created
April 10, 2013 19:32
-
-
Save lgmkr/5357725 to your computer and use it in GitHub Desktop.
generate UUID in ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::uuid generates a v4 random UUID (Universally Unique IDentifier). | |
p SecureRandom.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594" | |
p SecureRandom.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab" | |
p 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 address, time, etc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment