Skip to content

Add custom randomFunction option to geneticAlgorithmConstructor#10

Open
chadkirby wants to merge 1 commit intopanchishin:masterfrom
chadkirby:custom-random
Open

Add custom randomFunction option to geneticAlgorithmConstructor#10
chadkirby wants to merge 1 commit intopanchishin:masterfrom
chadkirby:custom-random

Conversation

@chadkirby
Copy link

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant