Created
April 28, 2016 08:45
-
-
Save Pengeszikra/9dcba0ac9d33e0dcab16776454648732 to your computer and use it in GitHub Desktop.
five digit random radix32 ID ES6
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
| /* five digit random radix32 ID */ | |
| function GUID32(){ return ('0'.repeat(5)+( ~~(Math.random() * parseInt( 10e4 , 32 )) ).toString(32).toUpperCase()).slice( -5 ) }; |
Author
Author
simpliest without ID length
Math.random().toString(32).slice(2).toUpperCase()
Author
Base64 random string generator without pattern
btoa(Math.random()).slice(3,-2)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
regexp version
test case: chance for Math.random().toString(36) hold only numbers
result of 1e8