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,27 @@
constrain: procedure options (main);
declare 1 point (100),
2 x fixed binary,
2 y fixed binary;
declare (i, j, a, b, c) fixed binary;
j = 0;
do i = 1 to 100;
a = 30*random()-15; b = 30*random()-15;
c = sqrt(a**2 + b**2);
if abs(c) >= 10 & abs(c) <= 15 then
do; j = j + 1; x(j) = a; y(j) = b; end;
end;
/* PLOT */
declare table(-15:15, -15:15) character (1);
table = ' ';
do i = 1 to j;
table(x(i), y(i)) = '*';
end;
do i = -15 to 15;
put skip;
do j = -15 to 15;
put edit (table(i,j)) (a);
end;
end;
end constrain;

View file

@ -0,0 +1,43 @@
*process source attributed xref or(!);
annulus: procedure options (main);
/* version 1 does not handle (0/15) etc. this does. */
/* we show 1000 points here */
declare 1 point(10000),
2 x fixed binary,
2 y fixed binary;
declare (i, j, a, b, a2, b2, c) fixed binary(31);
j = 0;
do i = 1 to 1000;
r=rand(31); a=r-16;
r=rand(31); b=r-16;
a2=a*a;
b2=b*b;
c2=a2+b2;
if c2>= 100 & c2 <= 225 then
do; j = j + 1; x(j) = a; y(j) = b;
/* put Edit(a,b,c)(3(F(3))); */ end;
end;
/* PLOT */
declare table(-15:15, -15:15) character (2);
table = ' ';
do i = 1 to j;
table(x(i), y(i)) = '*';
end;
do i = -15 to 15;
put skip;
do j = -15 to 15;
put edit (table(i,j)) (a);
end;
end;
rand: Proc(n) Returns(Bin Fixed(31));
/*--------------------------------------------------------------------
* Return a random integer between 1 and n
*-------------------------------------------------------------------*/
Dcl r Bin Float(31);
Dcl (n,d) Bin Fixed(31);
r=random();
d=r*n+1;
Return(d);
End;
End annulus;