instantiate gameobject[]

How can I do, to instantiate cubes on top of another?
I want to instantiate cubes, one on top of the other within a list, between a minimum “int” and an “int” maximum, using random range. determining the height of the cube. (inside the list of objects, instantiate them every 3 meters in height, between one object and another) example:
4 objects within the instanced list.
obj0 = 3 meters high obj1 = 6 meters high obj2 = 9 meters high obj3 = 12 meters high
the number of objects in the list may vary, since you would use random range to know how many objects there will be
I would like to apply it to this code!:

public Int MinF=1;
public Int MaxF;
public Int value;
public GameObject prefab;
public GameObject[] cubeList;

 Ray ray;
 RaycastHit hit;

  Public void genBuild(){

 value = Random.Range (MinF, MaxF);

 cubeList = new GameObject[value];

 for(int value=MinFloor; value < cubeList.Length;value++){
     GameObject clone = (GameObject)Instantiate(prefab,Vector3.up,Quaternion.identity);
     cubeList[value] = clone;


public void Update(){

if (Physics.Raycast (ray, out hit)) {
 if ( Input.GetMouseButtonUp(0)){

         genBuild ();


Check this page Unity - Scripting API: Object.Instantiate you can either specify the height of the cubes so they stack up or set them as childs of your parent object by locating the transform of the parent object