RosettaCodeData/Task/Constrained-random-points-on-a-circle/XPL0/constrained-random-points-on-a-circle.xpl0
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

13 lines
466 B
Text

include c:\cxpl\codes; \intrinsic 'code' declarations
int X, Y, C, R2;
[SetVid($13); \set 320x200x8 graphics mode
C:= 0; \initialize point counter
repeat X:= Ran(31)-15; \range -15..+15
Y:= Ran(31)-15;
R2:= X*X + Y*Y;
if R2>=10*10 & R2<=15*15 then
[Point(X+160, Y+100, $F); C:= C+1];
until C >= 100;
C:= ChIn(1); \wait for keystroke
SetVid(3); \restore normal text mode
]