title: Generating random sample from the quantiles of unknown density in R
body: <p>How can I generate random sample data from the quantiles of the unknown density <code>f(x)</code> for <code>x</code> between <code>0</code> and <code>4</code> in R?</p>
  
  <pre><code>     f = function(x) ((x-1)^2) * exp(-(x^3/3-2*x^2/2+x))
  </code></pre>