TITLE: Will this procedure generate random points uniformly distributed within a given circle? Proof?
QUESTION [11 upvotes]: Consider the task of generating random points uniformly distributed within a circle of a given radius $r$ that is centered at the origin. Assume that we are given a random number generator $R$ that generates a floating point number uniformly distributed in the range $[0, 1)$.
Consider the following procedure:

Generate a random point $p = (x, y)$ within a square of side $2r$ centered at the origin. This can be easily achieved by:
a. Using the random number generator $R$ to generate two random numbers $x$ and $y$, where $x, y \in [0, 1)$, and then transforming $x$ and $y$ to the range $[0, r)$ (by multiplying each by $r$).
b. Flipping a fair coin to decide whether to reflect $p$ around the $x$-axis.
c. Flipping another fair coin to decide whether to reflect $p$ around the $y$-axis.
Now, if $p$ happens to fall outside the given circle, discard $p$ and generate another point. Repeat the procedure until $p$ falls within the circle.

Is the previous procedure correct? That is, are the random points generated by it uniformly distributed within the given circle? How can one formally [dis]prove it?

Background Info
The task was actually given in Ruby Quiz - Random Points within a Circle (#234). If you're interested, you can check my solution in which I've implemented the procedure described above. I would like to know whether the procedure is mathematically correct or not, but I couldn't figure out how to formally [dis]prove it.
Note that the actual task was to generate random points uniformly distributed within a circle of a given radius and position, but I intentionally left that out in the question because the generated points can be easily translated to their correct positions relative to the given center.

REPLY [3 votes]: I'm not saying that your method is the simplest one to obtain  uniformly distributed sample points in the disk $D$ of radius $r>0$, but it is certainly correct.
Let $Q:=[{-r},r]^2$ and assume that the points generated in step 1. of your procedure are uniformly distributed in $Q$. For any set $A\subset Q$ denote by $|A|$ the area of $A$ and by $P(A)$ the probability that a sample point $p$ falls on the set $A$. Then one has the well known  formula about switching conditionals:
$$P(A\,|\,D)={P(A)\>P(D\,|\,A)\over P(D)}\ .$$
Now when $A\subset D$ then $P(D\,|\,A)=1$, and by assumption
$$P(A)={|A|\over|Q|},\quad P(D)={|D|\over|Q|}\ .$$
It follows that
$$P(A\,|\,D)={|A|\over|D|}\qquad\forall \> A\subset D\ ,$$
as it should be.