Random and If Else help

@Chrisir, I may try that approach (and realize it would be much easier), but I really want to be using x,y coordinates to “draw” the rectangles with lines connecting the randomly determined coordinate locations. I think I will turn the four lines into a function (as @kll suggested) and then try to use collision detection.

I’m struggling to understand why the approach in my first post isn’t working when

//x1 = random(0,width/2); is commented on.

I would think that is saying, “okay, chose a value for x1 between 0 and half width” and the next line “if” x1 is greater than width/4, make y1 be between 0 and height/4, “if else” let y1 be anywhere between 0 and height/2… anyone have thoughts on that?