I have code that randomly selects 15 sprites from 51 sprites. It can generate 2 duplicated sprites (this is acceptable for me) but I want to avoid 3 duplicated values. How can I prevent that?
My code
for (int i = 0; i < 16; i++)
{
int arrIndex = UnityEngine.Random.Range(0, tasSprites.Length);
tasSprite = tasSprites[arrIndex];
tasName = tasSprite.name;
taslar.Add(Int32.Parse(tasName));
}