Random Loc then Collsion detection

I have a script that starts with a loop like:

for (i=1;i<6;i++) {

MC_mc._x = random(10);
MC_mc._y = random(10);

That works fine. The MCs are scattered all around the stage.

But many overlap and I can’t have that. I know it’s collision detection and I’m pretty sure I need a nested FOR loop to check each time, but the syntax eludes me. I’m not super fluent with FOR loops.

Any help would be greatly appreciated.