Sattolo cycle: Difference between revisions

no edit summary
m (add RPL - bug in loop value)
No edit summary
Line 887:
print arr[]
</syntaxhighlight>
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils,StdCtrls}}
 
 
<syntaxhighlight lang="Delphi">
procedure ShowSattoloCycle(Memo: TMemo);
 
procedure ShowIntArray(Title: string; IA: array of integer);
{Display title and array}
var I: integer;
var S: string;
begin
S:=Title+' [';
for I:=0 to High(IA) do
begin
if I<>0 then S:=S+' ';
S:=S+IntToStr(IA[I]);
end;
S:=S+']';
Memo.Lines.Add(S);
end;
 
 
procedure ShowShuffleData(var IA: array of integer);
{Shuffle and display specified array}
begin
ShowIntArray('Original data:', IA);
DoSattoloCycle(IA);
ShowIntArray('Shuffled data:',IA);
end;
 
 
begin
{Shuffle and display all data items}
ShowShuffleData(SatTest1);
ShowShuffleData(SatTest2);
ShowShuffleData(SatTest3);
ShowShuffleData(SatTest4);
ShowShuffleData(SatTest5);
end;
 
</syntaxhighlight>
{{out}}
<pre>
Original data: []
Shuffled data: []
Original data: [10]
Shuffled data: [10]
Original data: [10 20]
Shuffled data: [20 10]
Original data: [10 20 30]
Shuffled data: [20 30 10]
Original data: [11 12 13 14 15 16 17 18 19 20 21 22]
Shuffled data: [18 11 16 15 22 17 20 21 12 19 14 13]
Elapsed Time: 11.480 ms.
 
</pre>
 
 
=={{header|F_Sharp|F#}}==
465

edits