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.