Simulate from an (arbitrary) continuous probability distribution [duplicate]
问题 This question already has answers here : How do I best simulate an arbitrary univariate random variate using its probability function? (4 answers) Closed 5 years ago . For a normalized probability density function defined on the real line, for example p(x) = (2/pi) * (1/(exp(x)+exp(-x)) (this is just an example; the solution should apply for any continuous PDF we can define) is there a package in R to simulate from the distribution? I am aware of R's built-in simulators for many distributions