I am student of statistics from Mexico and I always like to deeply understand the logic of the subjects in each of my courses. This time with the Rejection sampling method.

I understand very well why we need the "c" constant that multiplies our proposal density "g (x)" in order to majorize our target density "f (x)"

My question is about te acceptance/rejection rule:

We generate a random value from a uniform(0,1), let's call it U

and if U <f(x)/cg(x)

We accept the proposed value of x and otherwise we reject it.

I can't understand this logical step. It makes me confused that this U value can be any number between 0 and 1, therefore it is also random if this value is bigger or lesser than f(x)/cg(x), and hence it is an ambiguous rule.

I hope someone can help me out with this!