Pascal 洗牌
程序员文章站
2022-04-05 12:35:30
...
Procedure Shuffle(Var data:Array Of integer);
Var i: integer;
j: integer;
k: integer;
Begin
randomize;
i := high(data);
Repeat
j := trunc(random()*100) Mod i;
k := data[i];
data[i] := data[j];
data[j] := k;
dec(i);
Until i <= low(data);
End;