I can't talk for C++, but at least the random() function in Free Pascal sometimes produces the same value in a short time.
So,
x[n] := random(100);
y[n] := random(100);
could produce
x[1] = 15
y[1] = 34
x[2] = 20
y[2] = 10
and
x[3] = 15
y[3] = 18
Thus, if I used these values as upper left corner of a room, two rooms would overlap. So I had to do a separate check.
But perhaps C++ does it a different way.