Sample uniformly from a circle’s area
LinkedInMachine Learning Engineer · OnsiteLast updated
This question evaluates understanding of continuous probability distributions and geometric random sampling, testing whether a candidate recognizes how area-weighted uniformity differs from naive radial choices.
How would you generate a point (x, y) uniformly at random from the area of a circle of radius R centered at the origin?
- Explain why naive choices (e.g., choosing radius uniformly in
[0,R]) are not uniform over area. - Provide a correct sampling method (math + pseudocode).
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.