Can't you also generate P without knowing the inverse CDF using the accept-reject method? I.e., given the max value of the pdf for P, M, we can do:
Generate Y ~ Uniform(a,b) where [a,b] is the support for P.
With probability (b-a)p(y)/M accept the sample. Otherwise, generate a new Y and repeat.
Can't you also generate P without knowing the inverse CDF using the accept-reject method? I.e., given the max value of the pdf for P, M, we can do: Generate Y ~ Uniform(a,b) where [a,b] is the support for P. With probability (b-a)p(y)/M accept the sample. Otherwise, generate a new Y and repeat.