title: Random distribution within part of a circle within a grid cell
body: <p>Lets say I have a grid for spatial hashing. I am looking for a way to generate a set of randomly distributed points for each hash cell so the points are created within the portion of the circle that 'falls' in the cell. For example, in the image below, if I were to iterate through each hash cell, how would I generate points ONLY within the shaded portion of the circle for each cell?</p>
  <p><a href="https://i.stack.imgur.com/tXcaG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tXcaG.jpg" alt="enter image description here" /></a></p>
  <p>I realize that the more simple solution would to be to generate the points within the circle's radius, then stick em all in the spatial hash grid. However, the points I am generating are for graph nodes to be connected through randomly created edges. I could start creating edges as nodes are inserted in their appropriate hash cell but because they <em>are</em> being created randomly, so are their edges and it creates unwanted crisscrossing intersections.</p>
  <p>Therefore, I am thinking I could iterate through each hash cell, generate a set amount of points/nodes then connect them all before moving to the next cell. This way -- at least in my mind -- this would reduce the amount of intersecting edges as I could enforce a maximum distance for each one, but also ensure that all nodes within the cell are connected.</p>
  <p>This would be easy enough if I was not concerned with the 'shape' of the distribution but I do want these nodes to stay inside the radius of a circle. So is there a way of generating points ONLY within the shaded portion of the circle by iterating through each cell?</p>