Answers for "c# linq shuffle list"

C#
3

c# list shuffle

var rnd = new Random();
var randomized = list.OrderBy(item => rnd.Next());
Posted by: Guest on July-22-2021
4

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;
}
Posted by: Guest on February-14-2021

C# Answers by Framework

Browse Popular Code Answers by Language