posted 22 years ago
with this method you can generate "words" with the lenght you want:
//the argument n is the number of words you want
//the argument len is the lenght of the words
public String[] generateWords(int n, int len){
String[] words=new String[n];
char[] eachWord=new char[len];
for (int j=0;j<n;j++){
for (int i=0;i<len;i++){
//I assume you have a method convertToLetter where you have assigned a numeric value to each letter, and which receives a 0-1 number and returns a char.
eachWord[i]=convertToLetter(Math.Random());
}
words[j]=new String(eachWord);
}
return words;
}//end of method
-HTH
[ July 12, 2002: Message edited by: Juanjo Bazan ]
[ July 12, 2002: Message edited by: Juanjo Bazan ]