// Random Shape
global proc shapeGen()
{
    int $randShape = rand(2.9999);
    print("You got shape number: " + $randShape + "!\n");

    if ($randShape == 0)
    {
        int $numCubes = 5;
        float $radius;
        string $allCubes[]; // declare string array that stores the names of the cubes in the array 
    
        for ($cu = 0; $cu < $numCubes ; $cu++) // initialisation / condition / iteration
        {
            string $cubeName[] = `polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
		    $allCubes[$cu] = $cubeName[0]; // use the counter to gather the names
				    					        // of each new cube and save it in a list
    	}
	    select -r $allCubes; // select all the new cubes and group them
	    group;
    }      
    else if ($randShape == 1) 
    {
        int $numSpheres = 5;
        string $allSpheres[];
      
        for ($sp = 0; $sp < $numSpheres; $sp++)
        {
          string $sphereName[] = `polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1`;
          $allSpheres[$sp] = $sphereName[0];
        }
        select -r $allSpheres;
        group;
    }
    else if ($randShape == 2)
    {
        int $numCones = 5;
        string $allCones[];
        
        for ($co = 0; $co < $numCones; $co++)
        {
           string $coneName[] = `polyCone -r 1 -h 2 -sx 20 -sy 1 -sz 0 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1`;
           $allCones[$co] = $coneName[0];
        }
        select -r $allCones;
        group;
    }
}