Will this procedure generate random points uniformly distributed within a given circle? Proof? 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.
 A: 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.
A: Yes this will work; it's called rejection sampling.
Even better is to generate a point in polar coordinates though:  pick θ from [0, 2π) and r2 from [0, R2] (ie. multiply R by the square-root of a random number in [0, 1] - without the square-root it is non-uniform).
A: I'm going to use $P(a,b)$ for probability of x = a, and y = b.
$P(a,b) = P[x = |a|]P[y = |b|] * 1/4$ for any a, b inside the square.
Therefore you are picking a coordinate uniformly inside the square.
Now the problem reduced to the following:
Pick a element uniformly in a set A, then discard ones that are not B (B is a subset of A). Is it the same as pick a element uniformly in the set $A \cap B = B$?
I think this is true, I don't know if the following is a formal proof(haven't done probability in a while). please point out my mistakes.
P(B) is the event that a element in B is picked. P(A) is the event that a element in A is picked.
Pick a x uniformly, we have b \in B is P(x=b|B), it's obviously uniform.
The conditional probability P(B|A) = P(A \cap B)/P(A) = P(B)/P(A) = P(B) 
P(A) = 1, w/e you pick are in A.
P(x=b| (B|A)) = P(x=b|B), which is uniform.
Answer to your question: It is uniformly distributed. 
