mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-04 04:51:16 +08:00
added a check to avoid word repeating quickly
This commit is contained in:
parent
5f0c4dc92f
commit
bc709d7e87
1 changed files with 2 additions and 1 deletions
|
@ -232,7 +232,8 @@ function initWords() {
|
|||
for (let i = 0; i < wordsBound; i++) {
|
||||
randomWord = language[Math.floor(Math.random() * language.length)];
|
||||
previousWord = wordsList[i - 1];
|
||||
while (randomWord == previousWord || (!config.punctuation && randomWord == "I") || randomWord.indexOf(' ') > -1) {
|
||||
previousWord2 = wordsList[i - 2];
|
||||
while (randomWord == previousWord || randomWord == previousWord2 || (!config.punctuation && randomWord == "I") || randomWord.indexOf(' ') > -1) {
|
||||
randomWord = language[Math.floor(Math.random() * language.length)];
|
||||
}
|
||||
if (config.punctuation && config.mode != "custom"){
|
||||
|
|
Loading…
Reference in a new issue