Say I have a function function $f(x)$ returning any real between 0 and 1, for a $x$ between 0 and 1.
I want to get $n$ randomly generated values of $x$, based the probablity they occur from $f(x)$.
Example: If $n=5$, and $f(x)$ described a direct ascending line from 0 to 1, I could get $x_1=0.8$, $x_2=0.7$, $x_3=0.75$, $x_4=0.4$, $x_5=0.3$.
Basically, the higher $f(x)$, the more the random value tends to $x$.
Any idea how to achieve that?