From 0e96c88697f9dd9b1b4b45b084a7a28c2f47b524 Mon Sep 17 00:00:00 2001 From: elioat Date: Fri, 5 Jan 2024 22:21:18 -0500 Subject: * --- js/name-gen/app.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'js') 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 }; }; -- cgit 1.4.1-2-gfad0