Apologies if this has been posted before, I have looked and couldn't find an answer.
I am trying to make a program that will choose a random assortment of 9 letters where the user specifies how many each of consonants and vowels to select.
So far I have:
char consonants [] = {'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z'};
char vowels [] = {'a','e','i','o','u'};
String word = "";
int howManyVowels, howManyConsonants;
public void generateLetters(){
for(int i = 0; i < howManyVowels; i++){
word.append(vowels[Math.random(howManyVowels)*5]+1);
}
for(int j = 0; j < howManyConsonants; j++){
word.append(consonants[Math.random(howManyConconants)*21]+1);
}
}
The first error I get is: "error: method random in class Math cannot be applied to given types".
I would really appreciate if someone could tell me where I am going wrong. Thanks!
Aucun commentaire:
Enregistrer un commentaire