LinkedIn · Probability & Brainteasers
Sample uniformly from a circle’s area
TrueInterview
October 7, 2026 · 1 min read
A disk of radius R is centered at (0, 0). Design a random process that produces a real-valued point (x, y) such that the probability of landing in any region inside the disk is proportional only to that region's area. Equivalently, every two regions with equal area inside the disk must have the same probability of containing the point.
Your answer must do three things:
- Explain why independently choosing the radius uniformly from and the angle uniformly from does not produce an area-uniform distribution over the disk.
- Give a correct sampling procedure, including enough mathematical justification to show that it is uniform with respect to area.
- Write the procedure as pseudocode.
Points on the boundary of the disk are allowed; the boundary has probability zero, so it does not affect the distribution.
The examples below show one possible valid draw for each input. The exact coordinates will vary between random runs.
Example 1:
Input: R = 2.0
Output: (1.14, 0.76)
Explanation: This is a valid sample because it satisfies ; the sampler is judged by its distribution, not by matching this exact point.
Example 2:
Input: R = 5.0
Output: (-3.11, 2.72)
Explanation: Another valid sample; its distance from the origin is less than 5.0.
Example 3:
Input: R = 0.25
Output: (0.072, -0.033)
Explanation: A valid sample for a very small disk of radius 0.25.
Constraints:
Ris a positive real number.- The result is a pair of real numbers
(x, y)with . - You may assume access to a uniform random generator for real values in and, if needed, a uniform random generator for angles in .
- Provide mathematical reasoning and pseudocode rather than only a concrete implementation.