Transformation method
Let p(x)dx be the desired probability function with a corresponding distribution function y=P(x). The inverse of the latter P-1(y) is assumed to be known.
Sample y from a uniform distribution in (0,1)
x has the desired probability p(x)dx