Last active
January 23, 2017 23:08
-
-
Save TLMcode/2ee14e28f32e989f1c70 to your computer and use it in GitHub Desktop.
Random String Generator
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
gen( len ) | |
{ | |
loop % (122, d="~") | |
cStr .= chr( (i:=a_index)>32&&i<60 ? i : i>59&&i<91 ? i : i>93&&i<125 ? i : "" ) d | |
cStr:=regexreplace(cStr, d d) | |
while ( strlen(nStr)<len ) | |
{ | |
sort, cStr, % "Random D" d | |
nStr .= ((v:=substr(regexreplace(cStr,d),1,20))~="\d" | |
&&v~="[!-/]"&&v~="[:-@]"&&v~="[^-`]"&&v~="[A-Z]"&&v~="[a-z]" | |
&&!(v~="[A-Z]{2}")&&!(v~="[a-z]{2}")&&!(v~="\d{2}")) ? v : "" | |
GuiControl,, Disp, % substr(v,1,6) | |
} | |
GuiControl,, Disp | |
return substr(nStr,1,len) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New version with sister handler
Old version kept for reference.