Last active
July 21, 2020 09:06
-
-
Save semiherdogan/89f77553f4c57c84c4f0aa15b32bbe73 to your computer and use it in GitHub Desktop.
Boop random string generator
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
/** | |
{ | |
"api":1, | |
"name":"Random String", | |
"description":"Generates random string", | |
"author":"Semih", | |
"icon":"quote", | |
"tags":"random, string" | |
} | |
**/ | |
function main(state) { | |
state.fullText = state.fullText + '\n' + randomString(10); | |
state.postInfo('Random string generated'); | |
} | |
function randomString(length) { | |
const Characters = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz123456789'; | |
const CharactersLength = Characters.length; | |
let result = ''; | |
for (let i = 0; i < length; i++) { | |
result += Characters.charAt(Math.floor(Math.random() * CharactersLength)); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment