I know that by just using a random angle and a random radius within the bounds of your circle, you will end up with points near the center of a circle. Whereas if you do $\sqrt{Random(0,1)}*MaxRadius$ for your radius, you will end up with what appears to be a uniformly random point. I am happy this works but I would like to understand where the square root comes from. The Square Root function in this calculation seems magical to me and I would like to know what it means in this context.
[Math] Random Uniformly Distributed Points in a Circle
polar coordinatesprobabilityrandom
Related Solutions
If the radius of the big circle is $R$ and you're a distance $\rho < R$ from the center, then you're safe if the center of the little circle lands within a distance $R/2$ from you. That is, the center of the little circle has to be within the lens-shaped intersection of two circles of radius $R/2$ whose centers are $\rho$ apart. The area of such an intersection is readily found to be $$ \frac{1}{2}R^2\cos^{-1}\left(\frac{\rho}{R}\right)-\frac{1}{2}\rho\sqrt{R^2-\rho^2} $$ (e.g., see this MathWorld article). The probability that you're safe is obtained by dividing this by $\pi R^2/4$, the area of the little circle: $$ P(\rho)=\frac{2}{\pi}\cos^{-1}\left(\frac{\rho}{R}\right)-\frac{2}{\pi}\frac{\rho}{R}\sqrt{1-\frac{\rho^2}{R^2}}. $$ Plotting this against $\rho/R$ shows that, not surprisingly, you're safest right in the center. However, that requires you to stand at a single location, which is probably dangerous in and of itself... if you assess the utility of being at radius $\rho$ with some benefit for having room to move around, you may find a nontrivial answer.
In a 2D case, generating a random point in a bounding rectangle and throwing away points outside the ellipse isn't that ineffective. However, it is very ineffective if you generalise it for high dimension. I will tell you a way which is intuitive, effective for high dimension and it is guaranteed to terminate in fixed time.
You imagine that the ellipse is a bottle. You calculate the volume and you spill random amount of water into the bottle. The random point you are looking for is somewhere on the level of water. In this case, it is a line. This way, the task reduced by one dimension. Next thing you have to do is choosing a random point of the line you got, which is trivial.
The same thing more formally: You choose the $x$-coordinate by the marginal distribution $p(x)$. After that, you choose the $y$-coordinate by the distribution given $x$, i.e. $p(y|x)$. And you are done.
You can use the same trick for other shapes also, for example simplexes.
Best Answer
The point is that the area of the circle of radius $r$ is $\pi r^2$, and you want the probability of distance $\le r$ from the centre to be proportional to that area.