Suppose we want to simulate pseudo random numbers from the following distribution, which I came across in r - Finding a way to simulate random numbers for this distribution - Cross Validated,
where and .
Xi'an provided a very elegant solution.
the distribution is the distribution of
Thus, the R code to simulate is simple to be
x = pmin(rexp(n, a), rexp(n, b/(p+1))^(1/(p+1)))