16 lines
407 B
Text
16 lines
407 B
Text
randomDisc(numPoints):= block([p: []],
|
|
local(goodp, random_int),
|
|
goodp(x, y):=block([r: sqrt(x^2+y^2)],
|
|
r>=10 and r<=15
|
|
),
|
|
random_int():= block([m: 15], m - random(2*(m+1)-1)),
|
|
while length(p)<numPoints do block (
|
|
[x: random_int(), y : random_int()],
|
|
if goodp(x, y) then (
|
|
p: cons([x, y], p)
|
|
)
|
|
),
|
|
p)$
|
|
|
|
p: randomDisc(100)$
|
|
plot2d(['discrete, p], ['style, 'points]);
|