Hola
bulc, que bien que ya lo hayas solucionado.
Te comparto otra posible solución. La idea es interactuar con el memo lo menos posible para que sea mas eficiente.
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
function getListaDesordenada(const Max: Integer): TArray< string >;
var
i: Integer;
lList: TList < Integer >;
begin
Result := [];
lList:= TList < Integer >.Create;
try
for i := 1 to Max do
lList.Add(i);
for i := lList.Count-1 downto 0 do
lList.Exchange(i, Random(i+1));
for i := 0 to lList.Count - 1 do
Result := Result + [Format('%.2d', [lList[i]])];
finally
lList.Free;
end;
end;
var
lMax: Integer;
begin
if (not TryStrToInt(edtMax.Text, lMax))
or (lMax = 0)
then
Exit;
Memo1.Lines.Clear;
Memo1.Lines.AddStrings(getListaDesordenada(lMax));
end;