I am trying to code a game which currently uses a matrix ( that I am calling a map). On this map are islands which can be generated n times. The purpose of the algorithm is to distribute the islands across the map in a way that makes use of the space to ensure they are not too close or too far away from each other. This means that they cannot be too close to the edges of the map but not too centralised either. So the nature of the algorithm should not be random.
Here are some example outcomes if the algorithm functions correctly:
Notice that when there is an odd number of elements on an even matrix then there is an island in a odd position.