Spawn Obstacle prefabs randomly

I’m new to learning C#, and i’m working on an 3 laned Endless Runner as one of my first projects. Right now i’m working on procedural generation for the terrain (with the obstacles and/or a pit being on the terrain), and i’ve got it all figured out, but ran into a problem. I have a number of obstacle prefabs, and i’ve managed to spawn one of the prefabs (the prefab with no obstacle or pit). But i’m trying to spawn all the prefabs randomly up the z axis. So my question is how do i go about doing it, my code is below:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ObstacleManager : MonoBehaviour
{

public GameObject[] obstaclePrefabs;

private Transform playerTransform;
private float spawnZ = 0.0f;
private float obstacleLength = 2.0f;
private float safeZone = 6.0f;
private int amnObstaclesOnScreen = 10;

private List<GameObject> activeObstacles;

// Start is called before the first frame update
private void Start()
{
	activeObstacles = new List<GameObject>();
	playerTransform = GameObject.FindGameObjectWithTag("Player").transform;

	for (int i = 0; i < amnObstaclesOnScreen; i++)
	{
			SpawnObstacle();

	}
}

// Update is called once per frame
private void Update()
{
	if (playerTransform.position.z - safeZone > (spawnZ - amnObstaclesOnScreen * obstacleLength))
	{
		SpawnObstacle();
		DeleteObstacle();
	}
}

private void SpawnObstacle(int prefabIndex = -1)
{
	GameObject go;
	go = Instantiate(obstaclePrefabs[0]) as GameObject;
	go.transform.SetParent(transform);
	go.transform.position = Vector3.forward * spawnZ;
	spawnZ += obstacleLength;
	activeObstacles.Add(go);
}

private void DeleteObstacle()
{
	Destroy(activeObstacles[0]);
	activeObstacles.RemoveAt(0);
}

}

@RobAnthem So let me see if i’ve got this. Make some empty gameobjects that act like checkpoints, and attatch that scipt to each of them, and that will help provide the generation of my obstacle prefabs up the z axis. I’m pretty new to c# so i apoligize if dont understand things.