using System; namespace Plugins.JNGame.Util { public static class RandomUtil { public static Func SyncRandom(int seed,int start = 1) { for(var i = 0; i < start; i++){ seed = (seed * 9301 + 49297) % 233280; } return () => { seed = (seed * 9301 + 49297) % 233280; var rnd = seed / 233280.0; return 0 + rnd * (1 - 0); }; } public static Func SyncRandomInt(int seed,int start = 1) { var nRandom = SyncRandom(seed, start); return (min, max) => (int)(Math.Round(nRandom() * (max - min)) + min); } public static Func Next(int start) { return () => start++; } } }