list random shuffle c# code example
Example 1: c# randomize a list
var shuffledcards = cards.OrderBy(a => Guid.NewGuid()).ToList();
Example 2: c# shuffle list
for (int i = 0; i < fruitsList.Count; i++)
{
Fruit fruitCurrentIndex = fruitsList[i];
int randomIndex = Random.Range(i, fruitsList.Count);
fruitsList[i] = fruitsList[randomIndex];
fruitsList[randomIndex] = fruitCurrentIndex;
}