Sinisterly
[AutoIt]Random Alpha-Numeric Generator - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Coding (https://sinister.ly/Forum-Coding--71)
+--- Thread: [AutoIt]Random Alpha-Numeric Generator (/Thread-AutoIt-Random-Alpha-Numeric-Generator)



[AutoIt]Random Alpha-Numeric Generator - 1234hotmaster - 09-26-2011

Code:
Func _RandomAlphaNum($len) Dim $OP,$Alpha[27] = ["a", "b", "c", "d", "e", "f", "g", _ "h", "i", "j", "k", "l", "m", "n", _ "o", "p", "q", "r", "s", "t", "u", _ "v", "w", "x", "y", "z"] Do Switch Random(1,4,1) case 1 $OP &= $Alpha[Random(0,26,1)] case 2 $OP &= StringUpper($Alpha[Random(0,26,1)]) case 3 $OP &= Random(0,10,1) EndSwitch Until StringLen($OP) >= $len Return $OP EndFunc