01-08-2016, 12:27 AM
The function:
Usage:
Entropy is obviously not a major concern here, but this comes in handy.
Code:
Func _pGenerate($sLen)
Local $aCharset = StringSplit("0123456789!@#$%^&*-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "")
Local $sRand = 0, $sDupCheck = 0, $sReturn = ""
For $i = 1 to $sLen
$sRand = Round(Random(1, $aCharset[0], 1))
if $sRand < ($sDupCheck - 4) OR $sRand > ($sDupCheck + 4) Then
$sReturn &= $aCharset[$sRand]
$sDupCheck = $sRand
Else
$i -= 1
EndIf
Next
Return $sReturn
EndFunc ;==> _pGenerate()
Usage:
Code:
Local $length = InputBox("Length", "How many characters?")
ClipPut(_pGenerate($length))
MsgBox(64, "Results", "Added the new string to the clipboard")
Entropy is obviously not a major concern here, but this comes in handy.