Reputation: 45943
SecureRandom#urlsafe_base64 contains punctuation characters.
What is a good way to use it to generate a UUID of given length(12) containing only numbers, uppercase and lowercase letters?
Ruby 1.9.3
Upvotes: 1
Views: 150
Reputation: 54984
How about:
SecureRandom.urlsafe_base64.gsub(/\W/, '')[0..11]
#=> "x7lADtl95FUH"
Upvotes: 3