0

Suppose I have a PDF in the form of $$PDF(x;a,b)=\frac{f(x)}{\int\limits_a^b f(x)dx}$$ which is defined for $a\leq x\leq b$ and $f(x)\geq0$.

For example, if $f(x)=x^2+1$ and $a=0,b=2$ and I take any random variable from $0$ to $2$ with given PDF, then clearly $2$ has way more chances to appear than $0$ but I don't know how to quantify that. My goal is to define a function gets a random value for given PDF.

Garmekain
  • 3,124
  • 13
  • 26
  • 'My goal is to define a function gets a random value for given PDF' - no idea what this means. Maybe give an example? What pdf are you given? What function do you want to define? – spaceisdarkgreen Jan 20 '17 at 07:35
  • 1
    check out http://stackoverflow.com/questions/29095070/how-to-simulate-from-an-arbitrary-continuous-probability-distribution –  Jan 20 '17 at 07:56

0 Answers0