Algorithmic challenge: generate a list of random non overlapping squares
You could perhaps use a 2 dimensional k-d tree to store the set of free positions $(x, y)$ where the left upper corner of a new square could be chosen without overlapping the existing squares. Each node of the tree covers a region in the area $a$ and you can decorate this node with this region's coordinate and the number of free positions that it contains. At the top of the tree, you can read the total number of available slots and simply choose a random number to get the index of that slot. By walking downwards in the tree, you can find which slot corresponds to this random number, then update the tree accordingly to add a new square.
My intuition is that the amount of data contained in the tree is approximately proportional to the number $k$ of squares already chosen and that the addition of a new square should be proportional to $\log k$ on average.
Edit: I wrote a working implementation in python 3 by using a tree structure. I'm not sure about the performance for large $n$ but it could  already be measured experimentally. I didn't make any effort to balance the tree but as new squares are chosen randomly, this randomness should balance the tree on average.
Here is a link to the program. I don't know if I can paste it in this post. It chooses randomly at most 10 squares that don't touch each other. Here is an example output