Created
October 21, 2014 08:16
-
-
Save aliirz/66af713ed7a1dec4d2da 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 create_uuid(prefix=nil) | |
time = (Time.now.to_f * 10_000_000).to_i | |
jitter = rand(10_000_000) | |
key = "#{jitter}#{time}".to_i.to_s(36) | |
[prefix, key].compact.join('_') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment