Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,6 @@
declare T(0:10) fixed binary initial (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
declare (i, j, temp) fixed binary;
do i = lbound(T,1) to hbound(T,1);
j = min(random() * 12, 11);
temp = T(j); T(j) = T(i); T(i) = temp;
end;

View file

@ -0,0 +1,23 @@
kn: Proc Options(main);
/*--------------------------------------------------------------------
* 07.01.2014 Walter Pachl translated from REXX version 2
* Iteration i: only the first i elements are candidates for swapping
*-------------------------------------------------------------------*/
Dcl T(10) Bin Fixed(15) Init(1,2,3,4,5,6,7,8,9,10);
Dcl (i,j,temp) Bin Fixed(15) init(0);
Dcl h Char(6);
Call show('In',10); /* show start */
do i = 10 To 2 By -1; /* shuffle */
j=random()*i+1;
Put string(h)Edit(i,j)(f(2),f(3));
temp=t(i); t(i)=t(j); t(j)=temp; /* t(i) <-> t(j) */
Call show(h,i); /* show intermediate states */
end;
Call show('Out',10); /* show final state */
show: Proc(txt,n);
Dcl txt Char(*);
Dcl n Bin Fixed(15);
Put Edit(txt,(t(k) do k=1 To n))(Skip,a(7),10(f(3)));
End;
end;