How do I not print the same option again?
I am trying to create a console MCQ that prints the questions in a random order and prints the options different every time the user takes the MCQ again. But the same options sometimes get printed together... Here is my code static void printQn() { Questions mcq = new Questions(); Random gen = new Random(); int optionCount = 1; int x = gen.Next(5); Console.WriteLine(mcq.questions[x]); mcq.questionsBool[x] = true; while (optionCount < 5) { int y = gen.Next(4); if (mcq.optionsBool[x, y] == true) { int z = gen.Next(4); Console.WriteLine("[" + optionCount + "]" + mcq.options[x, z]); mcq.optionsBool[x, z] = true; optionCount++; } else if (mcq.optionsBool[x,y] == false) { Console.WriteLine("[" + optionCount + "]" + mcq.options[x, y]); mcq.optionsBool[x, y] = true; optionCount++; } } } static void Main(string[] args) { printQn(); } class Questions { public string[] questions = {"Who was the first Queen of England?", "What is the biggest island on Earth?", "How many Grand Slam singles titles has Roger Federer won? ", "When was the Euro introduced as legal currency on the world market? ", "What year was the first Harry Potter movie released?" }; public bool[] questionsBool = {false,false,false,false,false};