Created
May 11, 2015 09:12
-
-
Save MattiasFestin/d8872e88ea3f30dac33b to your computer and use it in GitHub Desktop.
a small simple uuid function for javascript
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
let Uuid = () => { | |
let r = (s) => { | |
let p = (Math.random().toString(16)+"000000000").substr(2,8); | |
return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p; | |
}; | |
return r() + r(1) + r(1) + r(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment