x & y are two random points selected uniformly between 0 & 1. Using them, create a point uniformly random in circle of radius 1. (uniform means that the probability density is constant)
HintSuppose x & y are outcomes of blackbox. [ x*cos(2 pi y) , x* cos(2 pi y) ] is not a uniform point on disc. Neither is the point (x,y)/sqrt(x^2+y^2) uniform.
Solution
theta = 2pi*x and r = squareroot(y). the take the point as (r*cos(theta),r*sin(theta))
Explanation:
The idea is that the probability of a point to be between r and r+dr is 2pi*r*dr. Hence to choose a radius we need to generate a number from random number generator which follows probability distribution 2*r.To generate random number which follows above probability distribution which follows uniform distribution we simply take the square root of the number generated by uniform distribution.