In honour of Pi Day (March 14), the chart shows six ways of randomly selecting a point in a unit disc. Four of the methods are bad, for various reasons.
A. Midpoint of random p, q on circumference
p = (cos(𝜃1), sin(𝜃1)) is a point on the circumference
q = (cos(𝜃2), sin(𝜃2)) is another point on the circumference
x = ½ cos(𝜃1) + ½ cos(𝜃2) and
y = ½ sin(𝜃1) + ½ sin(𝜃2), for random 𝜃1 and 𝜃2, define their midpoint.
B. Random polar coordinates
x = r cos(𝜃)
and y = r sin(𝜃), for random angle 𝜃 and radius r ≤ 1. This gives choices biased towards the centre.
C. Random y, then restricted x
Random y, followed by random x in the range −√(1−y2) to √(1−y2). This gives choices biased towards the top and bottom.
D. Random point on chord in A
Similar to A, but x = a cos(𝜃1) + (1−a) cos(𝜃2)
and y = a sin(𝜃1) + (1−a) sin(𝜃2), for random 𝜃1 and 𝜃2 on the circumference of the circle and random a between 0 and 1. This gives choices biased towards the periphery.
E. Random polar with sqrt(r)
Similar to B, but x = √r cos(𝜃)
and y = √r sin(𝜃), for random angle 𝜃 and radius r. The square root operation makes the selection uniform across the disc.
F. Random x, y within disc
Random x and y, repeating the choice until x2 + y2 ≤ 1. This is uniform, and the selection condition restricts the final choice to the disc.
Oh, and here are some Pi Day activities.