/// <summary> /// Creates a new <typeparamref name="TRng"/> using a seed created from <paramref name="seedingRng"/>. /// </summary> /// <param name="factory">The factory creating the new RNG.</param> /// <param name="seedingRng">The RNG used to create the seed.</param> /// <returns>A new <typeparamref name="TRng"/> instance.</returns> public static TRng Create <TRng, TSeed, TSeedingRng>(this IReproducibleRngFactory <TRng, TSeed> factory, TSeedingRng seedingRng) where TRng : notnull, IRng where TSeedingRng : notnull, IRng { var seed = factory.CreateSeed(seedingRng); return(factory.Create(seed)); }
public void FactoryIntCreation() { var seedRng = new StepRng(0xF0F0_F0F0_F0F0_F0F0); IReproducibleRngFactory <Mt1993764, UInt64> factory = Mt1993764.GetFactory(); var seed = factory.CreateSeed(seedRng); var rng = factory.Create(seed); Assert.True(Statistics.TestMonobitFrequency32(rng, 100_000, Statistics.WideZScore)); Assert.True(Statistics.TestMonobitFrequency64(rng, 100_000, Statistics.WideZScore)); Assert.True(Statistics.TestMonobitFrequencyFill(rng, 100_000, Statistics.WideZScore)); }
internal RngSeeder(IReproducibleRngFactory <TRng, TSeed> rngFactory, TSeedingRng seedSource) { _rngFactory = rngFactory; _seedSource = seedSource; }