you need the expression to account for layer height and width when calculating the boundaries for the random position area.
if the anchor points are in the centers of each layer, this should deep them within the boundaries of the comp: seedRandom( index, true ) ;
xSize = width * scale / 100 ;
ySize = height * scale / 100 ;
x = random( xSize / 2, thisComp.width - xSize / 2 ) ;
y = random( ySize / 2, thisComp.height - ySize / 2 ) ;
I don't know of a good way to prevent overlapping layers with a random expression.... you could work a way to manually adjust the position for overlapping layers... so the expression would do 75% of the work, but you'd need to adjust several of the layers that overlap....
to try that, set the layers' positions to 0, 0 and change the last line to: value + [ x, y ]
you should now be able to move overlapping layers manually.