Created
June 28, 2019 04:50
-
-
Save jeiea/3abf11b2e43313f1313b748939897262 to your computer and use it in GitHub Desktop.
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
/** | |
* @return example: '0zz12948ab0', length fixed | |
*/ | |
function getRandomString(): string { | |
const rand = Math.random() * 2 ** 52; | |
const pad = '00000000000'; | |
const padded = pad + rand.toString(36); | |
return padded.substr(padded.length - pad.length); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment