fixed number appearing in wrong places with punctuation enabled

This commit is contained in:
Jack 2021-04-15 20:17:40 +01:00
parent cd6afb4b30
commit dc06badad3

View file

@ -469,8 +469,15 @@ export async function init() {
randomWord = punctuateWord(previousWord, randomWord, i, wordsBound);
}
if (Config.numbers) {
if (Math.random() < 0.1) {
if (
Math.random() < 0.1 &&
i !== 0 &&
Misc.getLastChar(previousWord) !== "."
) {
randomWord = Misc.getNumbers(4);
if (i == wordsBound - 1) {
randomWord += ".";
}
}
}