Constrained random points on a circle: Difference between revisions

Added 11l
(→‎{{header|Perl}}: added version with plain-text output)
(Added 11l)
Line 11:
2) Precalculate the set of all possible points (there are 404 of them) and select randomly from this set.
<br><br>
 
=={{header|11l}}==
{{trans|Julia}}
<lang 11l>F print_circle(lo, hi, ndots, pad = 2)
V canvas = [[0B] * (2*hi+1)] * (2*hi+1)
V i = 0
L i < ndots
V x = random:(-hi..hi)
V y = random:(-hi..hi)
I x^2 + y^2 C lo^2 .. hi^2
canvas[x + hi][y + hi] = 1B
i++
 
L(i) 0 .. 2*hi
print(canvas[i].map(j -> I j {‘♦ ’} E ‘ ’).join(‘’))
print_circle(10, 15, 100)</lang>
 
=={{header|Ada}}==
1,481

edits