hastebin/lib/key_generators/phonetic.js

14 lines
338 B
JavaScript

module.exports = class PhoneticKeyGenerator {
createKey(keyLength) {
let text = '';
let isConsonant = Math.random() < 0.5;
for (let i = 0; i < keyLength; i++) {
text += isConsonant ? randConsonant() : randVowel();
isConsonant = !isConsonant; // Toggle between consonant and vowel
}
return text;
}
};