Spawn random in area and then remove

Hi, I’ve recently begun trying to create a system for generating objects within given areas on a terrain. By default i would simply use random.range(value 1, value 2) to achieve this.

------------------------------------.

However since i do not want these objects to overlap each other. I want to give them areas to determine where and where not it should be. Also, these areas needs to be different since im using them in a way to create areas for placing other objects, basicly im randomly trying to create areas for cities and the subobjects being houses.
-------------------------------------.
Heres a pic to show what im trying to achieve:[121274-grej-copy.png |121274]

----------------------------------------.
Problem is i have no idea how i would go about spawning these areas in a manner so they do not go ontop of each other. They cannot be brought into a grid structure since i wanna keep the randomness they have and i prefer not to simply retry the spawn process if it happens to land onto a other area since that process could go about happening several times.
-----------------------------------------.

So the way I’ve figured out would work is if i could remove the areas from the spawn area…but i have no idea how to do that.

---------------------------------------.

(removing the blue spots from the red areas in the picture)

----------------------------------------.
any help or ideas are appriciated, thanks.

There is a good link here if you look at the first section about room that’ll explain this next part beter than I can,

But basically create a box collider of a pseudo random size, (i.e. in some bound you desire),

Then repeat that again but if the colliders overlap (see: here for how to do this) then try again.

Set a finite number of attempts and then leave the loop early if you have an amount of rooms you’re happy with.