geneticalgorithm
geneticalgorithm copied to clipboard
Add custom randomFunction option to geneticAlgorithmConstructor
This commit introduces a new randomFunction option to the geneticAlgorithmConstructor to (among other things) support the use of seeded random number generators (RNG) for generating consistent results across different runs. Deterministic outputs make testing easier, and improves the user experience.
Changes:
Added the randomFunction option to the constructor with a default value of Math.random(). Replaced all occurrences of Math.random() with settings.randomFunction in the index.js file. Updated the test file to include a new test case for verifying the functionality of the randomFunction option.