I was coding something when this problem came up and it looks deceptively simple yet I can’t figure out a clever algorithm for it:
Can you come up with an algorithm that picks a random point inside a circle such that you have an equal chance of picking any single point in the circle?
For example, choosing a random theta and a random r wouldn’t work since you’re more likely to pick a point closer to the centre.
I managed to come up with a generalised one for polygons that involves decomposing them into right triangles but I can’t seem to do the same for circles. The closest I can come up with is to draw a polygon that completely covers the circle and pick a random point from that, if it falls outside of the circle, then repeat until you find a point inside the circle. But thats really lame and I’m sure theres a better method.
Any thoughts?