In R, what's the best way to simulate an arbitrary univariate random variate if only its probability density function is available?

# R – How to best simulate an arbitrary univariate random variate using its probability function

rrandom

Skip to content
# R – How to best simulate an arbitrary univariate random variate using its probability function

###### Related Question

rrandom

In R, what's the best way to simulate an arbitrary univariate random variate if only its probability density function is available?

## Best Solution

Here is a (slow) implementation of the inverse cdf method when you are only given a density.