# Random points on surface with minimal distance

Hello!

I want to place x number of points on a surface to create random vonoroi pattern, however these randomized points should be at a minimal distance from each other and preferably from the edge also.

The logic I started on is create many point, pick the ones intersecting the surface, draw circles around them, remove the ones intersecting the boundary line then somehow remove as may as required to have the desired amount of point left and they are not intersecting each other.
I guess I need help with this part but it’s also possible that my logic is a dead end.

Typically I recommend using a structured U or V value here as it is more consistent. By forcing points to always be N units apart in one direction and random in the other you can quickly constrain the spacing to that minimum value while maintaining the random pattern. Give that a shot and see if it works as it’s going to be MUCH faster.

Otherwise Point.PruneDuplicates with the desired distance as your tolerance, followed by making your circles, trimming your surface by those loops, casting new points and finding the ‘closest point to on the surface’ using a Geometry.ClosestPointTo node will be the next best bet. Note that this option will require some degree of recursion until you meet the desired number of points (in case say the next go-around put all points closer to each other than the desired tolerance), and that all surfaces have a maximum point count (try placing 10,000,000 points spaced 1 unit apart on a surface that is 2 units by 2 units).