Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public static T PickRandom <T>(this T[] array) => array[LocalRandom.Range(0, array.Length)];
Exemplo n.º 3
0
 public static T PickRandom <T>(this List <T> list) => list[LocalRandom.Range(0, list.Count)];