var somInstance : SomeClass = targetArray[random(0,targetArray.length)].GetComponent(SomeClass);
someInstance.SomeFunction();
or a better approach would be to store the instances you need in an array (preferably a builtin array ) and then just call the function
var targetArray : SomeClass[];
targetArray = new SomeClass[someSize];
--- assign the scripts ---
targetArray[random(0,targetArray.length)].SomeFunction();
that way you don’t need to call GetComponent and builtin arrays are much faster than Array.