Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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;
}
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #shuffle #list
ADD COMMENT
Topic
Name
5+5 =