using System; using System.Collections.Generic; using System.Text; namespace Superlazy { public class SLRandom { private readonly SLEntity root; private readonly string key; public SLRandom(SLEntity root, string key) { this.root = root; this.key = key; if (this.root[key] == false) { this.root[key] = new Random().Next(); } } public int Next(int min, int max) { int seed = root[key]; root[key] = new Random(seed).Next(); return new Random(seed).Next(min, max); } public double NextDouble() { int seed = root[key]; root[key] = new Random(seed).Next(); return new Random(seed).NextDouble(); } } }