I am making a word game that picks 8 random letters from the alphabet and the player must find words that use these letters. I must find out a way to make the letters picked always contain 3 vowels and 5 consonants. I would appreciate your help
Here is the code I am using to pick the random letters for the game
function makeid(length) {
var result = '';
var characters = 'aaabcdeeefghiiijklmnooopqrstuuuvwxyz';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
let letter = characters.charAt(Math.floor(Math.random() * charactersLength));
while (result.match(letter)) {
letter = characters.charAt(Math.floor(Math.random() * charactersLength));
}
result += letter;
}
return result;
}
console.log("Id of 8 characters", makeid(8))