Created
February 2, 2016 06:33
-
-
Save vko-online/76cc31b6e5cf834ad8ac to your computer and use it in GitHub Desktop.
Generate 4 alpha-numberic symbols, useful for SMS services, DOM id attrs
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
//this will generate 8wde for example | |
function genShortUid() { | |
return ('0000' + (Math.random()*Math.pow(36,4) << 0).toString(36)).slice(-4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment