Last active
February 12, 2019 21:58
-
-
Save Xsmael/9b9c74e0a6063b4b1db42eb1194450fe to your computer and use it in GitHub Desktop.
Simple guaranteed unique, fast enough, not too long, id generator 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
//Guaranted unique fast enough id generator in JavaScript | |
function getUID() { | |
return Math.random().toString(36).substring(2, 15) | |
+'-'+Math.random().toString(36).substring(2, 15) | |
+'-'+Date.now().toString(36); | |
} | |
// inspired from https://stackoverflow.com/a/13403498/2429678 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment