Hello everyone! I am making a game with Xamarin Android.
It has 4 rounds, and I want to show 4 pictures at random, but the problem is that it can show pictures twice, or even more often.
I thought this code would fix it, but sadly it didn't.
if (ActivityGame.playing == false)
List alreadyGuessed = new List();
Random randomSound = new Random(); int theSound = randomSound.Next(1, 5); while (alreadyGuessed.Contains(theSound)) theSound = randomSound.Next(1, 5); alreadyGuessed.Add(theSound); return theSound; }
Anyone got any suggestions on how I make sure that it only shows a number once?