Skip to content

Instantly share code, notes, and snippets.

@ran488
Created January 18, 2017 23:15
Show Gist options
  • Save ran488/66c229a7704ae092b6d37380e8403e4b to your computer and use it in GitHub Desktop.
Save ran488/66c229a7704ae092b6d37380e8403e4b to your computer and use it in GitHub Desktop.
Generate a UUID from Ruby
require 'securerandom'
puts SecureRandom.uuid
# OR
# direct from command line: jruby -e "require 'securerandom' ; puts SecureRandom.uuid"
# IRB
# irb(main):001:0> require 'securerandom'
# true
# irb(main):002:0> SecureRandom.uuid
# "8af55604-db60-4347-bb0a-1e13ac058685"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment