This function generates a random key (using numbers and lower, upper case letters) with a given amount of characters.
Code:
Usage:
Output:
Code:
code_language.skript:
function genKey(l: number) :: text:
set {_abc} to "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuYvVwWxXyYzZ"
loop {_l} times:
set {_t} to random integer between 1 and 52
set {_n} to random integer between 0 and 9
if {_r} is set:
chance of 50%:
set {_r} to "%{_r}%%subtext of {_abc} from characters {_t} to {_t}%"
else:
set {_r} to "%{_r}%%{_n}%"
else:
chance of 50%:
set {_r} to subtext of {_abc} from characters {_t} to {_t}
else:
set {_r} to {_n}
return {_r}
Usage:
code_language.skript:
# e.g.
genKey(20)
# generates a random key with 20 characters
Output:
code_language.skript:
# e.g.
5dA3bE9PH636PGc9J55d