random placement of objects

what should we do if we want our game characters to be instantiated at random places but we don’t want them to be at particular places like on the door or on another character. my question is that is there any way to control random allotment of objects position in unity?

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

public class GameOpponentManager : MonoBehaviour
{
    
    public GameObject[] OpponentsQueue;
    public opponentManager opponentManagerScript;

    public void Start()
    {
        for(int i = 0; i< OpponentsQueue.Length; i++)
        {
            float randomZaxis = Random.Range(20, 800);
            if(randomZaxis % 100 == 0)
            {
                randomZaxis = randomZaxis + 5;
            }
            
            OpponentsQueue_.transform.position = new Vector3(0, OpponentsQueue*.transform.position.y, randomZaxis);*_

opponentManagerScript.SeparteStandFunction(OpponentsQueue.transform.GetChild(0).gameObject, OpponentsQueue_.transform.GetChild(1).gameObject, OpponentsQueue*.transform.GetChild(2).gameObject);
if(i > 2)
{*_

if (Vector3.Distance(OpponentsQueue*.transform.position, OpponentsQueue[i - 1].transform.position) < 5)*
{

Debug.Log(" distance is " + Vector3.Distance(OpponentsQueue*.transform.position, OpponentsQueue[i - 1].transform.position));*
OpponentsQueue*.transform.position =*
OpponentsQueue[i - 1].transform.position + new Vector3(0, 0, 10);
}

}

}
}

You can use Random.insideUnitCircle or insideUnitSphere to choose a point and Physics.OverlapBox to check if the space is empty