Uniform Distribution in a Ring Area

This post aims to provide an efficient method of generating uniformly distributed coordinates in a given ring area.

Without loss of generality, the ring area is illustrated in Figure 1. The inner and outer radii are \(R_1\) and \(R_2\), respectively, \(R_1 < R_2\). The corresponding angular scope starts from \(\Theta_1\) and ends at \(\Theta_2\), \(\Theta_1 < \Theta_2\).

ring.png

Figure 1: A ring area

In polar coordinate system, the joint probability density function (PDF) of the radius and angle can be written as

\begin{align*} f_{R, \Theta}(r, \theta) = \frac{2r}{(\Theta_2 - \Theta_1)(R_2^2 - R_1^2)}, \end{align*}

where \(\theta\in[\Theta_1, \Theta_2]\), \(r\in[R_1, R_2]\).

Then, the PDFs of the radius and angle can be expressed as

\begin{align*} f_R(r) &= \frac{2r}{R_2^2 - R_1^2}, \quad r\in[R_1, R_2];\\ f_{\Theta}(\theta) &= \frac{1}{\Theta_2 - \Theta_1}, \quad \theta\in[\Theta_1, \Theta_2]. \end{align*}

Consequently, the target coordinate can be generated as follows