Unity3d: Random.Range() Problem

I’m spawning objects from a list and so-far i got them to find a parent object that’s already live in the scene.The problem is Random.Range() isn’t working like I want. I want the listed Objects to spawn to a random parent, instead, they’re spawning to the they’re parent relative to the order of the list.

Ex. 0,1,2,3,4,5,6,7,8,9 = Bad

Ex. 8,3,1,4,6,3,7,9,5,2 = Good

lol

var theRange = Random.Range(obj1.Length,obj1.Length);
	for(var i: int = 0; i < theRange; i++){
		var obj2 : GameObject = obj1*;*
  •  if(obj2.transform.childCount == 0){*
    
  •  objfromList.transform.parent = obj2.transform;*
    
  •  objfromList.transform.localPosition = Vector3(0,-2,0);*
    
  • }*
    }
    Deeply thankful

Your problem lies in your first line: the two parameters passed to Random.Range are a min and max value, and you’re passing the same value for both - obj1.Length. So the only value that ever gets returned from Random.Range is obj1.Length itself.