For simplicity's sake let's say I'm referring to points inside a unit circle. If I have a list of points, e.g. (0.1, 0.3), (-0.4, 0.2) and (0.8, -0.1), and I want to randomly generate a new point that's not within, say, 0.1 units of any other point, what's the fastest way of doing this?
At the moment I'm just generating coordinates, looping through all of the coordinates, calculating the distance, and if it's too close then I repeat the entire process.
But this requires a lot of calculations, particularly if the chance of a collision is high meaning it has to loop potentially dozens of times. Hence why I'm hoping there's some kind of neat mathematical trick to speed up this process... :)
You may assume there's guaranteed to be an available space free.