I have a two-dimensional probability density field $f(x,y)$ with $$\int \int f(x,y)\,\mathrm{d}x\mathrm{d}y=1$$ And I would like to generate particles from that probability density field but I am not sure how to realize that computational wise.
My idea is to randomly choose a point $x_{i},y_{j}$ in the domain, and then create another uniformly random number $c$ between 0 and 1 and if that number is higher than the probability at that point $f(x_{i},y_{j})<c$, then I save this point as a particle location. But the results I obtain with this aren't as good. Is there a better way to do this? And does there exist a a technical term under which I can find literature about these kind of problems or methods?