public static void SwitchType(RandomGeneratorType type) { if (generator.type != type) { generator = RandomNumerGenerator.GetGenerator(type); } }
public RandomGenerator(int seed, RandomGeneratorType randomGeneratorType) { if (randomGeneratorType == RandomGeneratorType.DotNet) { rand = new DotNetRandomGeneratorSource(seed); } else if (randomGeneratorType == RandomGeneratorType.CMR) { rand = new CMRRandomGeneratorSource(seed / 200 + 1, seed % 200); } }
public static RandomNumerGenerator GetGenerator(RandomGeneratorType type) { switch (type) { case RandomGeneratorType.Pesudo: return(new PesudoGenerator()); default: return(null); } }
public static IRandomGenerator <int> Create(RandomGeneratorType type) { switch (type) { case RandomGeneratorType.Basic: return(new BasicRandomGenerator()); case RandomGeneratorType.Strong: return(new MersenneTwister()); } throw new InvalidRandomGeneratorTypeException(); }
public void Setup(RandomGeneratorType gen, int?oneSeed) { this.mGeneratorType = gen; this.mRotationCount = 1; this.mIndex = 0; // mRefillCounter = 0; if (oneSeed.HasValue == false) { Random random = new(); this.mBuffer[RandomGenerator.RandomByteBufferSize + 4] = random.Next(); } else { this.mBuffer[RandomGenerator.RandomByteBufferSize + 4] = oneSeed.Value; // set a specific seed as seed for the next round } this.CheckGenerator(); }
public RandomNumerGenerator(RandomGeneratorType type) { this.type = type; }