namespace Game.CardWars; /// /// Mulberry32 PRNG — a fast, high-quality 32-bit random number generator. /// public static class Mulberry32 { public static float NextFloat(ref uint state) { state += 0x6D2B79F5u; uint z = state; z = (z ^ (z >> 15)) * (z | 1u); z ^= z + (z ^ (z >> 7)) * (z | 61u); return (z ^ (z >> 14)) / (float)uint.MaxValue; } public static int NextInt(ref uint state, int min, int max) { return (int)(NextFloat(ref state) * (max - min + 1)) + min; } }