How can i ramdomly intantiate gameObjects without them instantiating on top of each other?

In my code i create ramdom positions and instantiate the GameObject in that position, them i make a loop to intantiate more.
The problem is that sometimes the GameObects are instantiated on top of each other. what can i do to solve that?

Here is the code

public GameObject cube;

public Collider plane;

int size;

int nCubes;

void Start()
    plane = GetComponent<Collider>();

    Vector3 center =;
    Vector3 inicio = plane.bounds.min;
    Vector3 fim = plane.bounds.max;

    nCubes = Random.Range(3, 6);

    for (int i = 0; i < nCubes; i++)
        Vector3 position = new Vector3(Random.Range(inicio.x, center.x), 0, Random.Range(inicio.z, fim.z));
        Instantiate(cube, position, Quaternion.identity);

You could keep a List(or array or whatever you prefer) of positions. Then, when you instantiate your GameObject add it’s position to the List. Then, when creating a new position, check it against the List to make sure it isn’t already used.