put random points in a square region while maintaining a minimum distance (Python)
If you had some grid overlay on top of the points, you could generate a circle whose radius is the minimum distance around each point, and flag each grid cell that's in those circles. Then, randomly pick a non-flagged grid cell to generate a point at, then repeat until there's no spaces left.
I have a square region of size [a, a] containing real number coordinates. I want to fill it with with N random points. The conditions is that the distance between any two points has to be greater than a minimum distance D.
The brute force way is to keep generating a random point until it meets the condition. But, to check the condition with all other points is kinda expensive. Is there a better algorithm to do this?