my question is quite generic. I am currently studying the algorithms calculating random numbers from distributions:

In inverse transform method we get the cumulative distribution function in the end and take the random variable from there. Whereas in rejection method, we are working directly with pdf. I got a little bit confused if we normally sample from cdf , since I have never come across it before.

I know what the cdf and pdf are and that they are tightly linked.

Hopefully, someone can clarify it to me if sampling from cdf is a common approach.

  • 4
    $\begingroup$ There are a very large number of ways to sample from a distribution. Many do not need mathematical representations of the PDF or the CDF. It's difficult to use the CDF directly, but its inverse -- the quantile function -- gives perhaps the simplest, most direct method of sampling provided the quantile function can be computed. For more about this particular method see stats.stackexchange.com/search?q=inverse+transform+sampling. $\endgroup$
    – whuber
    Commented Nov 12, 2020 at 17:12
  • 5
    $\begingroup$ Theoretically one can simulate from any function identifying the distribution, e.g., pdf, cdf, mgf, quantile function, characteristic function... $\endgroup$
    – Xi'an
    Commented Nov 12, 2020 at 17:26

1 Answer 1


There are algorithms that sample random variates using both the PDF and CDF of a distribution. One example is the inversion-rejection method described in chapter 7 of Non-Uniform Random Variate Generation (Devroye 1986), which works for any unimodal distribution for which the mode is known.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.