Sample uniformly from a circle’s area
Company: LinkedIn
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
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).
Quick Answer: 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.