Pick a random question

So to paint you a picture on what I’ve done:
I have an XML question base where both questions and the answers are stored. Right now I’m running a simple for loop which loads the first question and I increment it by 1 with each given answer. What I would like to actually do is generate a random question but also make sure that question never repeats again until all questions have been looped/answered.
All I can think of is to reload the list without the question that has been answered but I was hoping there might be a simpler and more optimized solution to this.
Thanks for the help in advance!

GUI.Label (new Rect (Screen.width / 2 - 275, 280, 550, 75), t.Questions[p].question);

		if(t.Questions[p].type.Equals("button")){
			
			for(int i=0;i<t.Questions[p].answers.Count;i++)
			{
				if (GUI.Button (new Rect (Screen.width / 2 - 275, 350+i*35, 550, 30), t.Questions[p].answers*.answer))* 
  •  		{*
    

_ if(t.Questions[p].answers*.correct==true){_
_
p++;_
_
}_
_
else{_
_
lives–;_
_
}_
_
}_
_
}_
_
}*_

Here’s some pseudo code for you:

// a list to store the index of the questions that have been answered already
List<int> answeredIndexList = new list<index>(); 

// loop through the questions
for (int i; <condition>; i++)  {
    // get a random question
    string question = questionsArray[Random.Range(0, arrayLength)];

    // skip the current question if it's already been answered
    if (answeredIndexList.Contains(i) {
        i--;
        continue;
    }

    // check whether the question is answered
    if (condition)  { 
        answeredIndexList.Add(i);
    }
}

This is the best way I can think if to do what you’ve asked. Hope it helps.