Note that (*) is 1-1 over [1,2]
Now, the inverses are:
n <- 1000
u <- runif(n)
x1 <- 2*sqrt(u+1) - 1
x2 <- 2*(u+1/4)
Now, for the rejection method, note that for g uniform [0,1], we have
for . This gives you
So, a uniformly generated x will be accepted if
This should get you started, I hope...
P.S. This is only my 2nd post, so please don't bash me too much...