private IRng GetRng() { Console.WriteLine("Create RNG"); Console.WriteLine("1. Box-Muller .Net 2. Math.Net MT 19937 3. Delegate-based Box-Muller "); Console.Write("4. Box-Muller Sitmo 5. Polar Marsaglia .Net 6. Box-Muller Crypto: "); int c = Convert.ToInt32(Console.ReadLine()); IRng rng; switch (c) { case 1: rng = new BoxMullerNet(); break; case 2: rng = new BoxMullerNet(); break; case 3: Console.WriteLine("Flavour"); Console.Write("1. .NET Random 2. Sitmo PRNG "); int c2 = Convert.ToInt32(Console.ReadLine()); // Delegate-based if (c2 == 2) { rng = new BoxMullerNet(); } else { Random rngNet = new Random(); RngDelegate rand = rngNet.NextDouble; rng = new BoxMullerII(rand); } break; case 4: rng = new BoxMullerNet(); break; case 5: rng = new PolarMarsagliaNet(); break; case 6: rng = new BoxMullerCrypto(); break; default: rng = new BoxMullerNet(); break; } return(rng); }
public BoxMullerII(RngDelegate randomGenerator) { rand = randomGenerator; }