Spawning diffrent objects [SOLVED]

Hello, guys! I have this script I’m working on. How can I make this both then-statements equally possible and randomly execute, but not at ONE time (like it does now)?

void Update ()
    {
        if (timer > maxTime)
        {
// first spawning object
            GameObject newwall = Instantiate(wall);
            newwall.transform.position = transform.position + new Vector3(0, Random.Range(-height, height), 0);
            Destroy(newwall, 15);
            timer = 0;
      // second spawning object       
            GameObject newmetal = Instantiate(metal);
            newmetal.transform.position = transform.position + new Vector3(0, Random.Range(-height, height), 0);
            Destroy(newmetal, 15);
            timer = 0;
        }

        timer += Time.deltaTime;
	}

Help me not to reinvent the wheel! Thank you!

void Update ()
{
if (timer > maxTime)
{
SpawnObject( Random.value < 0.5f ? wall : metal ) ;
timer -= maxTime; // Don’t reset to 0, otherwise, you will get a gap in the end
}

     timer += Time.deltaTime;
 }

private GameObject SpawnObject( GameObject prefab )
{
         GameObject instance = Instantiate( prefab );
         instance.transform.position = transform.position + new Vector3(0, Random.Range(-height, height), 0);
         Destroy(instance, 15);
         return instance;
}