public static void main(String[] args)
{
final int ELEMENTS = 13;
//int[] array = new int[ELEMENTS];
char[] array1 = new char[ELEMENTS];
printWord(array1);
}
public static void printWord(char[] array)
{
Random random = new Random();
int[] letters = new int[array.length];
for(int index = 0; index < array.length; index++)
{
letters[index] = random.nextInt(122)+97;
System.out.println(letters[index]);
}
System.exit(0);
}
My problem occurs within the method printword(). When it assigns a random integer to letters in the for loop the random method adds the 97 to the 122 instead of having a random number between 97-122. Question: I've always constructed my random method this way, and now its not working why? Can you help me with an alternative?