Hello guys I'm creating a program called Quiz game. Now my problem is how can I generate a non repeating questions? All of my questions is stored in a switch statement. I've tried and searched all of the possible solutions but still I get the same output. My code below is just a sample i didnt paste it all bcoz its too long. Whenever I call the method Question() it will random but sometimes the question that is already ask is being ask again.
public void Question()
{
var random = new Random((int)DateTime.Now.Ticks);
var randomValue = random.Next(1, 8);
switch (randomValue)
{
case 1:
ans = 1;
btnA.Visible = true;
btnB.Visible = true;
btnC.Visible = true;
btnD.Visible = true;
btn50.Enabled = true;
btndoubledip.Enabled = true;
lblQuestion.Text = "1+1=?";
voice = new SpeechSynthesizer();
voice.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Child);
voice.SpeakAsync(lblQuestion.Text.ToString());
btnA.Text = "2";
btnB.Text = "1";
btnC.Text = "4";
btnD.Text = "5";
}
break;