using System; using System.Collections.Generic; namespace PKHeX.Core { public static partial class Util { public static readonly Random Rand = new Random(); public static uint Rand32() { return (uint)Rand.Next(1 << 30) << 2 | (uint)Rand.Next(1 << 2); } /// /// Shuffles the order of items within a collection of items. /// /// Item type /// Item collection public static void Shuffle(IList items) => Shuffle(items, 0, items.Count); /// /// Shuffles the order of items within a collection of items. /// /// Item type /// Item collection /// Starting position /// Ending position public static void Shuffle(IList items, int start, int end) { for (int i = start; i < end; i++) { int index = i + Rand.Next(end - i); T t = items[index]; items[index] = items[i]; items[i] = t; } } } }