title: Generate matrix based on density function
body: <p>I'm trying to generate a <code>2</code>-by-<code>6</code> matrix of random numbers based on their density function, for example</p>
  
  <p>f(x)= 2x-4 for 2 &lt;  x &lt; 3; 0 otherwise</p>
  
  <p>So from what I understand I have to find the cumulative density function first, x<sup>2</sup>-4x, and then I have to invert it so that I can use the rand function.</p>
  
  <p>This is that part I do not understand, how do I get the inverted function</p>