Generating points in area with at least X gap length in-between
问题 I am trying to come up with a method for generating X amount of random points in a given area (in my case a square). The one thing that makes this such an issue is that each point has to be at least Y units away from all other points. What springs to mind at first is (in c#) to check the distance between the new point and all existing points: while(points.Count < pointsToGenerate) { Point newPoint = NewPoint(); bool addPoint = true; foreach(Point p in points) { if((p - newPoint).Length() <