title: Random generating coordinates within a circle
body: <p><strong>Scenario</strong><br/>
  I am trying to generate 500 to 1000 random coordinates (lat,long) that lies within a circle with 1 kilometer radius where center point located at (5.418680, 100.327829). I am trying to code this in php but failed to do so as i have no idea what value should i provide for $radius.</p>
  
  <pre><code>$radius = ?;
  $origin_x = 5.420525;
  $origin_y = 100.319500;
  
  $angle = deg2rad(mt_rand(0, 359));
  $pointRadius = mt_rand(0, $radius);
  
  $point[] = array(
      'x' =&gt; $origin_x + ($pointRadius * cos($angle)),
      'y' =&gt; $origin_y + ($pointRadius * sin($angle))
  );
  </code></pre>
  
  <p>There is another approach came across my mind. Instead of generating point within a circle, i would like to generate point inside a boundary of square and then apply Haversine great circle distance formula to determine is the random generated point lies within the circle with 1KM radius.</p>
  
  <p>Note: The generated point is fine to overlap each other.</p>
  
  <p>Please advise, I need general idea of what approach should I take. Thanks in advance.</p>