I am trying to generate random samples of points in the unit square in such a way that points inside a given circle are twice as likely to be selected as points outside of that circle.
I tried to approach the problem by creating a 2D distribution. To do that I need to transform the function
f[x_,y_]:= If[ (x-.5)^2 + (y-.5)^2 < .1, 1, .5]
into a probability distribution for both x and y between 0 and 1. Then I would use the PDF to generate points and eventually plot them. My main struggle comes from turning the If function into a two-variable PDF.
Comments
Post a Comment