📜  洗牌数组delphi代码示例

📅  最后修改于: 2022-03-11 14:54:56.346000             🧑  作者: Mango

代码示例1
procedure FastPermuteArray(A: TDynIntegerArray);
  procedure Swap(n, m: integer);
  var
    tmp: integer;
  begin
    tmp := A[n];
    A[n] := A[m];
    A[m] := tmp;
  end;
var
  i: Integer;
begin
  for i := High(A) downto 1 do
    Swap(i, RandomRange(0, i));
end;