Last active
August 29, 2015 14:06
-
-
Save clemgrim/0f5e01569c1be796298e to your computer and use it in GitHub Desktop.
This file contains 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
function getGUID() { | |
return 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function(c) { | |
var num = Math.random() *16 | 0, v = c === 'x' ? num : (num&0x3|0x8); | |
return v.toString(16); | |
}); | |
} | |
function getGUID() { | |
function fd() { | |
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); | |
} | |
return fd() + fd() + '-' + fd() + '-' + fd() + '-' + fd() + '-' + fd() + fd() + fd(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment