예제 #1
0
        public static T PopRandom <T>(this List <T> list)
        {
            var idx  = LocalRandom.Range(0, list.Count);
            var item = list[idx];

            list.RemoveAt(idx);

            return(item);
        }
예제 #2
0
 public static T PickRandom <T>(this T[] array) => array[LocalRandom.Range(0, array.Length)];
예제 #3
0
 public static T PickRandom <T>(this List <T> list) => list[LocalRandom.Range(0, list.Count)];