Expression denotes a `type', where a `variable', `value' or `method group' was expected

This code should take the colors from the array and put them randomly on he cube GameObject; but i get that error. (C#)

    	public GameObject cube;
    	public Color[] cubeColor;
    
    	void Update () 
    	{
    		if (Input.GetKeyDown (KeyCode.Space)) 
    		{
    			cube.GetComponent<Renderer> ().material.color = ChangeColor(cubeColor [Random (0, cubeColor.Length)]);
    		}
    	}
    
    	Color ChangeColor(Color newColor)
    	{
    		return newColor;
    	}

Line#8 change Random to Random.Range, e.g.:

cube.GetComponent<Renderer>().material.color = ChangeColor(cubeColor[Random.Range(0, cubeColor.Length)]);

P.S. Also I have no idea why you created and use ChangeColor function, as it just useless, unless you’re going to change something in it, it would be better to remove it completely and just:

cube.GetComponent<Renderer>().material.color = cubeColor[Random.Range(0, cubeColor.Length)];