EvilZone
Programming and Scripting => Other => : B1N4RY2.0 July 31, 2015, 03:56:55 AM
-
Apologies if this is the wrong subforum, only place I found an existing autoit thread ;)
Might come in handy for other n00bs like myself :)
Usage:
MsgBox(64, "Results", _pGenerate(16))
Source:
#include <String.au3>
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 - 8) OR $sRand > ($sDupCheck + 8) Then
$sReturn = $sReturn & $aCharset[$sRand]
$sDupCheck = $sRand
Else
$i -= 1
EndIf
Next
Return $sReturn
EndFunc ;==> _pGenerate()
-
Dat not random stuff
-
How so? It picks a random number corresponding to the related array which hold the text characters? Just curious as it seemed to spit out pretty random strings for me :)
-
How so? It picks a random number corresponding to the related array which hold the text characters? Just curious as it seemed to spit out pretty random strings for me :)
Its about the source of entropy, such random generators are not that random ,just saying.
For passwords this is midly important.
-
Ah yes in that aspect no it's not truly random, it does run on a predetermined algorithm to decide it's next "character" :) Was just something simple I wrote quick as an example since the forums seems to be lacking my favorite WinDoze language :D
-edit-
btw Just noticed the name, but if you haven't check out my other (newly) posted source, you may be amused with the original author LOL :D
-
Ah yes in that aspect no it's not truly random, it does run on a predetermined algorithm to decide it's next "character" :) Was just something simple I wrote quick as an example since the forums seems to be lacking my favorite WinDoze language :D
-edit-
btw Just noticed the name, but if you haven't check out my other (newly) posted source, you may be amused with the original author LOL :D
I noticed, it is a lotta fun to code something like it and get the results as a reward.
Well done.
:)