How to make rooms not spawn inside eachother

Im trying to make a random room generator that spawns rooms from a list of rooms but they sometimes spawn inside of eachother and i was wondering if there is a way to stop that. thanks! Here is my code :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RoomGeneration : MonoBehaviour
{
    public GameObject[] Rooms;
    public GameObject StartRoom;
    public GameObject PrevPoint;
    public float AmountToMake;

    // Start is called before the first frame update
    void Start()
    {
        for (int i = 0; i < AmountToMake; i++)
        {
            int Cool = Random.Range(0, Rooms.Length);
            if (PrevPoint.transform.parent.gameObject.name != Rooms[Cool].gameObject.name + "(Clone)")
            {
                GameObject Room = Instantiate(Rooms[Cool].gameObject, PrevPoint.transform.position, PrevPoint.transform.rotation);
                PrevPoint = Room.transform.Find("EndPoint").gameObject;
            }
            else if (PrevPoint.transform.parent.gameObject.name == Rooms[Cool].gameObject.name + "(Clone)")
            {
                int Cool2 = Random.Range(0, Rooms.Length);
                GameObject Room = Instantiate(Rooms[Cool2].gameObject, PrevPoint.transform.position, PrevPoint.transform.rotation);
                PrevPoint = Room.transform.Find("EndPoint").gameObject;
            }
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

Also the generation works by spawning a room at the end of the previous room and its 3d