Function Random String

Simple code for if you need random string character like password, id code and many others. here we go..

function kodeacak(PLen: Integer): string;
var
  str: string;
begin
  Randomize;
  str    := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  Result := '';
  repeat
    Result := Result + str[Random(Length(str)) + 1];
  until (Length(Result) = PLen)
end;


0 Response to "Function Random String"

Post a Comment