Created
July 23, 2013 17:20
-
-
Save gecbla/6064236 to your computer and use it in GitHub Desktop.
Returns a random UUID in javascript
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
/** | |
* @see http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript#answer-13403498 | |
* @see https://gist.github.com/jed/982883 | |
*/ | |
function b(a){return a?(a^Math.random()*16>>a/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,b)}; | |
var uuid = b(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment