Dynamic Programming21 sections · 916 units
Open in Course

Random Point in Circle - Problem Statement

Geometric probability

Generate a random point uniformly in a circle of radius rr. This isn't DP, but illustrates probability concepts.

Wrong approach: random angle + random radius. Points cluster near center because area grows with r2r^2. Correct: random angle, radius = rrandomr \cdot \sqrt{\text{random}}. The square root compensates for area growth. Alternatively: rejection sampling. Pick random (x,y)(x, y) in square, accept if x2+y2r2x^2 + y^2 \leq r^2.