function TfrmMain.RandomString(ALength: Integer): string; const Seeds = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var I, Index: Integer; begin Result := ''; Randomize; for I := 0 to ALength - 1 do begin Index := Random(Seeds.Length); Result := Result + Seeds.Chars[Index]; end; end;
procedure TfrmMain.Button2Click(Sender: TObject); begin edtToken.Text := RandomString(43); ShowMessage(Length(RandomString(43)).ToString); end;