'Random' does not contain a definition for 'Range"

I’m making a script to generate levels in an endless Runner, but I came across an issue any ideas on how to fix it?

public class GenerateLvl : MonoBehaviour
{ 
    [FormerlySerializedAs("section")] public GameObject[] Section;
    
    public int zPos = 50;
    public bool creatingSection = false;
    public int secNum;
    
    void Update()
    {
        if (creatingSection == false)
        {
            creatingSection = true;
            StartCoroutine(GenerateSection());
        }
    }

    IEnumerator GenerateSection()
    {
        secNum = Random.Range(0, 3);
        Instantiate(Section[secNum], new Vector3(0, 0, zPos), Quaternion.identity);
        zPos += 50;
        yield return new WaitForSeconds(2);
        creatingSection = false;
    }
}

you’re possibly using System.Random instead of UnityEngine.Random.

either add using UnityEngine; to the top of the file, or fully qualify the random call: secNum = UnityEngine.Random.Range(0, 3);

You should post the full error in future so it’s clear what namespaces are involved and what the error ID is.
You should also not remove the using statements when you send your code.

If this doesn’t say System.Random then you have made your own Random class, and should probably rename it to something else, or you can specify the namespace.