# Can one uniformly generate complex numbers of absolute value less than a given constant $R \neq 1$? [duplicate]

Can one uniformly generate complex numbers of absolute value less than a given constant R?

This would appear to be equivalent to picking points $$(x,y)$$ uniformly in a disk of radius R, where $$x$$ is the real component of the complex number, and $$y$$, its complex component.

This question appears to differ from numerous others that have been asked, in that $$R$$ is not assumed to equal 1 (that is, the unit disc).

(Note: I am a Mathematica user MathematicaQuestions, not an R [no pun, intended] user.)

• You may always take $R=1$ by choosing the disk's radius to be your unit of measurement. Regardless, fully general answers have been posted in the duplicate threads. – whuber Dec 29 '20 at 19:18

The MathWorld entry DiskPointPicking asserts (without an explicit proof) that to generate uniformly distributed points ($$x,y)$$ in the unit disk, one should employ $$$$x=\sqrt{r} \cos{\theta},\hspace{.2in} y=\sqrt{r} \sin{\theta}.$$$$ where $$r \in [0,1]$$, and $$\theta \in [0, 2 \pi]$$ are uniformly distributed variables.

So for points ($$x,y)$$ in a disk of radius $$R$$, it appears then that one should employ $$$$x=\sqrt{\tilde r} \cos{\theta},\hspace{.2in} y=\sqrt{\tilde r} \sin{\theta}.$$$$ where $$\tilde r \in [0,R^2]$$, and $$\theta \in [0, 2 \pi]$$ are uniformly distributed variables.

Upon further reflection/application, I'm somewhat confused here by my original answer (trying to apply the MathWorld argument).

Say, the maximum absolute value $$R$$ of the complex numbers $$x+ I y$$, I want to generate is $$\frac{1}{2}$$. Now (assuming $$x=y$$, which seems permissible), we have the relation, $$$$\sqrt{(\frac{1}{\sqrt{8}})^2+(\frac{1}{\sqrt{8}})^2}=\sqrt{\frac{1}{4}}= \frac{1}{2}.$$$$

So, it seems that I want to choose $$\tilde{r}$$--before taking its square root--from $$[0,\frac{1}{8}]$$, not $$[0,R^2 =\frac{1}{4}]$$.

???

• The proof for the radius distribution is that $(\rho,\theta)$ has density$$\rho\mathbb I_{0<\rho<R}\mathbb I_{0<\theta<2\pi}/R^2\pi$$ when moving from Euclidean to polar coordinates. Hence $r=\rho^2$ has density$$\mathbb I_{0<r<R^2}/R^2$$ – Xi'an Dec 29 '20 at 10:00
• @Xi'an Don't understand the double-bar notation. – Paul B. Slater Dec 29 '20 at 18:10
• $\mathbb I$ is an indicator function. – whuber Dec 29 '20 at 19:20