How to randomly choose a song and play it

In my game that I have been talking about recently, I’ve wanted to have unity randomly choose a song from my library and play it… Is there a way I can get it to do that?

here is how I did it:

public class musicTracks : MonoBehaviour {

    //Song Randomization

    private int LastSong = 0;

    public GameObject Music1;
    public GameObject Music2;
    public GameObject Music3;
    public GameObject Music4;
    public GameObject Music5;
    public GameObject Music6;
    public GameObject Music7;

    void Awake()
    {
        DontDestroyOnLoad(gameObject);
        SongSelector();

    }

    private int SongBefore;

    public void SongSelector()
    {

        //                              \\V// - Change For Song Number
        int NextSongNum = Random.Range(0, 7);

        if (LastSong == NextSongNum)
        {
            SongSelector();
        }
        else
        {
            SongBefore = LastSong;
            //Add More of these \\V// for more songs

            if (NextSongNum == 0)
            {
                //Turn Off Current Music
                Music1.SetActive(false);
                Music2.SetActive(false);
                Music3.SetActive(false);
                Music4.SetActive(false);
                Music5.SetActive(false);
                Music6.SetActive(false);
                Music7.SetActive(false);

                //Turn On
                Music1.SetActive(true);
                LastSong = 0;
            }

            if (NextSongNum == 1)
            {
                //Turn Off Current Music
                Music1.SetActive(false);
                Music2.SetActive(false);
                Music3.SetActive(false);
                Music4.SetActive(false);
                Music5.SetActive(false);
                Music6.SetActive(false);
                Music7.SetActive(false);

                //Turn On
                Music2.SetActive(true);
                LastSong = 1;
            }

            if (NextSongNum == 2)
            {
                //Turn Off Current Music
                Music1.SetActive(false);
                Music2.SetActive(false);
                Music3.SetActive(false);
                Music4.SetActive(false);
                Music5.SetActive(false);
                Music6.SetActive(false);
                Music7.SetActive(false);

                //Turn On
                Music3.SetActive(true);
                LastSong = 2;
            }

            if (NextSongNum == 3)
            {
                //Turn Off Current Music
                Music1.SetActive(false);
                Music2.SetActive(false);
                Music3.SetActive(false);
                Music4.SetActive(false);
                Music5.SetActive(false);
                Music6.SetActive(false);
                Music7.SetActive(false);

                //Turn On
                Music4.SetActive(true);
                LastSong = 3;
            }

            if (NextSongNum == 4)
            {
                //Turn Off Current Music
                Music1.SetActive(false);
                Music2.SetActive(false);
                Music3.SetActive(false);
                Music4.SetActive(false);
                Music5.SetActive(false);
                Music6.SetActive(false);
                Music7.SetActive(false);

                //Turn On
                Music5.SetActive(true);
                LastSong = 4;
            }

            if (NextSongNum == 5)
            {
                //Turn Off Current Music
                Music1.SetActive(false);
                Music2.SetActive(false);
                Music3.SetActive(false);
                Music4.SetActive(false);
                Music5.SetActive(false);
                Music6.SetActive(false);
                Music7.SetActive(false);

                //Turn On
                Music6.SetActive(true);
                LastSong = 5;
            }

            if (NextSongNum == 6)
            {
                //Turn Off Current Music
                Music1.SetActive(false);
                Music2.SetActive(false);
                Music3.SetActive(false);
                Music4.SetActive(false);
                Music5.SetActive(false);
                Music6.SetActive(false);
                Music7.SetActive(false);

                //Turn On
                Music7.SetActive(true);
                LastSong = 6;
            }
        }
    }
}

These are the old ways of doing things you should check out Scriptable objects now! If you want to try it hit me up and ill give you a file you can use and just plug in your own songs.