Last active
March 7, 2021 19:31
-
-
Save Albertbol/08167a796dcc497acb2839f6b6ba8336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mutationRate = 0.01 | |
mutate(child) { | |
const chars = child.split('') | |
for (let i = 0; i < chars.length; i++) { | |
if (Math.random() <= mutationRate) { | |
chars[i] = newChar() | |
} | |
} | |
return chars.join('') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment