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.