using System; using System.Collections.Generic; namespace DotRecast.Core; public static class CollectionExtensions { public static void forEach(this IEnumerable collection, Action action) { foreach (var item in collection) { action.Invoke(item); } } public static void Shuffle(this IList list) { Random random = new Random(); int n = list.Count; while (n > 1) { n--; int k = random.Next(n + 1); T value = list[k]; list[k] = list[n]; list[n] = value; } } }