Created
September 11, 2018 01:42
-
-
Save chris-campbell/0e2016c073745ca86fbf29cf0994f8e6 to your computer and use it in GitHub Desktop.
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
| def uuid | |
| characters = ("a".."f").to_a.concat((1..9).to_a) | |
| uuid = "" | |
| sequence = [8, 4, 4, 8, 12] | |
| sequence.each do |i| | |
| i.times { uuid += characters.sample.to_s } | |
| uuid += "-" unless i == 12 | |
| end | |
| uuid | |
| end | |
| uuid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment