Constrained random points on a circle: Difference between revisions

m
(added RPL)
 
(One intermediate revision by one other user not shown)
Line 1,052:
 
=={{header|EasyLang}}==
[https://easylang.dev/show/#cod=bY7NDoJADITvPMV3VIhkF4MnfBiCGDfhJ64E4e2Zit7soelMZ6Z9P0LX0gwTFd65BFi4EuvhNvacPSf8xdj1LxvFvp5x4rCQyplJl7IebRfuSqSSDfnUNfrSNiq7mAl/YT/OLaWT33KKfbSo4qcPsdGjH32e5Bs=bY0xDsIwFEP3nOKN0Igqv6hMzWGqtohIJYhPBMntUShsbLafZb8uYV2YYmJAnDNAxqNjnENMHIUDcqpx+R8rnsddE7tMQ8ZSaCj7ysIZcQweZYwzWqX0lcDn03rka6+350LvsNSdbpN1qvv1g07rsvVb05o3 Run it]
 
<syntaxhighlight>
while cnt < 100
x = randomrandint 31 - 16
y = randomrandint 31 - 16
r = sqrt (x * x + y * y)
if 10 <= r and r <= 15
Line 3,656 ⟶ 3,657:
=={{header|RPL}}==
{{works with|HP|48G}}
[[File:Constrained|thumb|alt=Screenshot of a HP-48G emulator, displaying constrained random points on a circle|HP-48G emulator screenshot]]
« ERASE -15 15 DUP2 XRNG YRNG <span style="color:grey">@ set graphics boundaries</span>
DEG -19 SF 0 <span style="color:grey">@ set degrees mode, polar vector mode, count = 0</span>
Line 3,668:
-19 CF
» '<span style="color:blue">TASK</span>' STO
[[File:Constrained|thumb.png|alt=Screenshot of a HP-48G emulator, displaying constrained random points on a circle|HP-48G emulator screenshot]]
 
The circle is actually an ellipse because RPL display screens are not squared.
 
=={{header|Ruby}}==
2,058

edits