diff options
author | elioat <elioat@tilde.institute> | 2024-01-05 22:21:18 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-01-05 22:21:18 -0500 |
commit | 0e96c88697f9dd9b1b4b45b084a7a28c2f47b524 (patch) | |
tree | 55f227c22003547449d5462f015de355bb848a68 /js | |
parent | 0f6ff2d0856e9e0009a94911e3c2eb2ca6ab2d67 (diff) | |
download | tour-0e96c88697f9dd9b1b4b45b084a7a28c2f47b524.tar.gz |
*
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 }; }; |