Skip to content

Instantly share code, notes, and snippets.

@evolutionxbox
Created June 13, 2017 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evolutionxbox/4907ab33bde06cd08ad53769bc27b2df to your computer and use it in GitHub Desktop.
Save evolutionxbox/4907ab33bde06cd08ad53769bc27b2df to your computer and use it in GitHub Desktop.
Simple Unique ID Generator (well, not entirely unique...)
function generateUniqueID() {
function chr4(){
return Math.random().toString(16).slice(-4);
}
return chr4() + chr4() +
'-' + chr4() +
'-' + chr4() +
'-' + chr4() +
'-' + chr4() + chr4() + chr4();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment