diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/name-gen/app.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/js/name-gen/app.js b/js/name-gen/app.js index a151520..2e97c06 100644 --- a/js/name-gen/app.js +++ b/js/name-gen/app.js @@ -13,6 +13,13 @@ syllables.forEach(syllable => { const generateName = () => { const nameLength = Math.floor(Math.random() * 3) + 2; const nameSyllables = Array.from({ length: nameLength }, () => syllables[Math.floor(Math.random() * syllables.length)]); + + if (Math.random() < 0.5) { + const vowels = ['a', 'e', 'i', 'o', 'u', 'y', 'ou', 'ey']; + const randomVowel = vowels[Math.floor(Math.random() * vowels.length)]; + nameSyllables[nameLength - 1] += randomVowel; + } + const name = nameSyllables.join('').charAt(0).toUpperCase() + nameSyllables.join('').slice(1); return { name, nameSyllables }; }; |