Random Text Udf

08/14/2013 02:12 Liented#1
Nothing difficult... if ever need a password generator, a way to make temp file with out worry too much about files that already exists or what ever you can use this...

As usual, append to the end of file and call it :D
E.G.

;Creates the temp file for text operations
$TempFile = @TempDir & "\" & _RandomText(10) & ".tmp"
$TempFile = FileOpen($TempFile)
Code:
Func _RandomText($N)
 ;$n is the lenght of string.
   If $N < 1 Then Return -1
   Local $COUNTER, $ALPHA, $RESULT
   
   For $COUNTER = 1 To $N
      If Random() < 0.5 Then
         $ALPHA = Chr(Random(Asc("A"), Asc("Z") + 1))
      Else
         $ALPHA = Chr(Random(Asc("a"), Asc("z") + 1))
      EndIf
      $RESULT = $RESULT & $ALPHA
   Next
   Return $RESULT
EndFunc  ;==>_RandomText