Junk Code Generator
[CLIKE]
[/CLIKE]
[CLIKE]
Код:
;START OF CONFIG
$target = 1000 ;number of lines
$file = "junk.txt" ;file to store in
$numlines = 10 ;number of temporary lines, 10 works p good
;END OF CONFIG
FileDelete($file) ;just in case it exists already, we don't want to waste our time!
Dim $lines[$numlines + 1] ;first we create the array
$lines[0] = $numlines ;this isn't really needed but i love my arrays like that.
_dimlines($numlines) ;dim the temporary lines for the first time
FileWrite($file, "") ;create the file
$i = 0 ;set an int to count our loop / the lines created
$stept = Random(20,30,1) ;after this the lines will get redimed in order to leave no pattern
Do ;start of a do loop
If $i = $stept Then ;With this we count to the next redim
$stept = $stept + Random($i + 20, $i + 30,1) ;and if it happens we set a new point for it (p random to leave no pattern again)
_dimlines($numlines) ;and redim all lines
EndIf ;End of that part!
$i = $i + 1 ;line count variable + 1
$rand = Random(1,10,1) ; create a random number
FileWriteLine($file, $lines[$rand]) ;and write one of the the temp lines to the file
$per = $i / $target * 100 ;calculate the %
ToolTip($i & "/" & $target & " lines created - That's " & $per & "%");and display a nice message for the user
Until $i = $target ;we do that until we reached the number of lines we want
Func _dimlines($dtarget) ;this is the func to dim/redim the the lines
$d = 1 ;a new int for the loop below
Do ;a do loop again :o
$lines[$d] = "$" & Random(50000,150000,1) & ' = "' & Random(50000,150000,1) & '"' ;That is how a line gets generate only 2 random numbers + the operators
$d = $d + 1 ;$d++
Until $d = $dtarget ;the loop does it for any temp line
EndFunc ;end of the func