theo hat geschrieben:Schaffst du das?
Wenn wir es nicht schaffen, schafft es Murphy bestimmt.
theo hat geschrieben:Schaffst du das?
mse hat geschrieben:Wenn wir es nicht schaffen, schafft es Murphy bestimmt.
Code: Alles auswählen
function RandomSort(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := -1 + Random(3);
end;
procedure TForm1.Button1Click(Sender: TObject);
var sl:TStringList;
i:integer;
cnt:QWord;
s:String;
begin
i:=0;
cnt:=0;
Randomize;
sl:=TStringList.create;
// for i:=65 to 90 do s:=s+chr(i)+LineEnding;
for i:=65 to 68 do s:=s+chr(i)+LineEnding;
sl.text:=s;
while not (Application.Terminated) do
begin
sl.CustomSort(@RandomSort);
if (cnt=High(Qword)) then break;
inc(cnt);
if cnt mod 100000 = 0 then
begin
Caption:=inttostr(cnt);
ListBox1.Items.Assign(sl);
Application.Processmessages;
end;
end;
sl.free;
end;