title: Generate points(x,y) on rectangle uniformly
body: <p>I would like to generate points(x,y) uniformly on rectangle. First You input minX and maxX and minY maxY and then you generate the (x,y) uniformly, The basic code is shown below is any better way to achive it? (I need it to monte carlo method to make a plot)</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;random&gt;
  double drand(const double min = 0., const double max = 1.)
  {
      return (max - min) * static_cast&lt;double&gt;(rand()) / static_cast&lt;double&gt;      (RAND_MAX)+min;
  }
  int main(int argc, char **argv)
  {
      for(unsigned short int i=0;i&lt;1000;++i)
      {
          std::cout &lt;&lt; "x " &lt;&lt; drand(minX, maxX) &lt;&lt; std::endl;
          std::cout &lt;&lt; "y " &lt;&lt; drand(0., maxY) &lt;&lt; std::endl;
      }
  return 0;
  }
  </code></pre>