Last active
November 16, 2017 02:28
-
-
Save m0o0scar/1745816e895bd526de8bd631f4afb5af to your computer and use it in GitHub Desktop.
Generate UUID
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
//generate an uuid with specify length | |
function uuid(length=26) { | |
let len = Math.min(length, 50)/2; | |
return Math.random().toString(36).substring(2, 2+Math.floor(len)) + | |
Math.random().toString(36).substring(2, 2+Math.ceil(len)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment