Last active
March 7, 2021 19:08
-
-
Save Albertbol/f6100ffe22e2421412a0d4e7c32d263d 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
selection() { | |
let index = 0 | |
let random = Math.random() | |
while (random > 0) { | |
random = random - population[index].powRate | |
index++ | |
} | |
index-- // index++ jumped to the next phrase | |
return population[index] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment