You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Sometimes I need to generate the same result with the same parameter, so the fixed PRNG seed will be one of the ways to do this.
Describe the solution you'd like
Add a constructor to RandomizationBase, and implement in all Randomization class
I ended up creating two static methods called ResetSeed for BasicRandomization and FastRandomization, because the way that they work right now, as thread-safe, the constructor approach wouldn't work.
Bellow a sample from a unit test showing how to use the ResetSeed method:
[Test]publicvoidResetSeed_GetInt_SameResults(){// Resets the seed for the first time.FastRandomRandomization.ResetSeed(1);vartarget=newFastRandomRandomization();varactual=newint[10];for(inti=0;i<actual.Length;i++){actual[i]=target.GetInt(int.MinValue,int.MaxValue);}// Resets the seed again with the same value, so the pseudorandom values generated by FastRandomRandomization will follow the same order.FastRandomRandomization.ResetSeed(1);for(inti=0;i<actual.Length;i++){Assert.AreEqual(actual[i],target.GetInt(int.MinValue,int.MaxValue));}}
Features
* #62 - Suggestion: Add an ability to set PRNG's initial seed
Bug fixes
* #72 - GeneticAlgorithm.BestChromosome.Fitness decrease over time when using EliteSelection
* #92 - Multiple occurances of same chromosome instance in generation
Is your feature request related to a problem? Please describe.
Sometimes I need to generate the same result with the same parameter, so the fixed PRNG seed will be one of the ways to do this.
Describe the solution you'd like
Add a constructor to
RandomizationBase
, and implement in all Randomization classThe text was updated successfully, but these errors were encountered: