This question already has an answer here:
- Randomize a List<T> 18 answers
I want each question to be displayed only once. Can someone help! :)
{
List<string> question = new List<string>();
question.Add("Question number 1");
question.Add("Question number 2");
question.Add("Question number 3");
question.Add("Question number 4");
Random Rand = new Random();
for (int i = 0; i < 4; i++)
{
int index = Rand.Next(0, 4);
displayQuestion.Text = question[index];
}
Aucun commentaire:
Enregistrer un commentaire