GA/Assets/Scripts/Extensions.cs
/// <summary>
/// Randomly rearranges the elements of a list.
/// </summary>
Randomly rearranges the elements of a list.
Randomly rearranges the elements of a list .
public static void ShuffleList<T>(this List<T> list) {
        int n = list.Count;
        while (n > 1) {
            int k = (UnityEngine.Random.Range(0, n) % n);
            n--;
            T value = list[k];
            list[k] = list[n];
            list[n] = value;
        }
    }
public static void ShuffleList < T > ( this List < T > list ) { int n = list . Count ; while ( n > 1 ) { int k = ( UnityEngine . Random . Range ( 0 , n ) % n ) ; n -- ; T value = list [ k ] ; list [ k ] = list [ n ] ; list [ n ] = value ; } }
Randomly rearranges the elements of a list.
Randomly rearranges the elements of a list .
List<T>
this