Hey guys so I'm new to C# and our professor just assigned us homework, and I'm trying to figure out how to get the object to drop randomly within a certain range but I don't know so can someone help me he gave us this code:

using UnityEngine;
using System.Collections;

public class SpawnerScript : MonoBehaviour {

public GameObject ball1Prefab;

private float spawnTimer;
private float spawnCounter;

void Start()
{
	
	spawnTimer = 1.0f;
	spawnCounter = 0.0f;
}

void Update () {
    
	spawnCounter += Time.deltaTime * 1;

	if (spawnCounter >= spawnTimer) {
	
		SpawnEgg ();
		spawnCounter = 0;
	}
		

}

void SpawnEgg()
{

	Instantiate (ball1Prefab, transform.position, Quaternion.identity);

}

}

Probably much to late, but it would have been something like this:

void SpawnEgg()
{
float Min = -5f, Max = 5f;
 
         Vector2 newPos = new Vector2(Random.Range(Min, Max), 10);
         Instantiate(ball1Prefab, transform.position + newPos, Quaternion.identity);
}