The line
generator.nextInt( word.length() - i - 1 );
would throw IllegalArgumentException
incase the argument <= 0..
Throws: IllegalArgumentException - if n is not positive
Check the length
of a string before calling the line
You could do it this way
for (x = 0; x < wordLen; x++) {
i = generator.nextInt(wordLen - 1);
j = generator.nextInt(wordLen);
if (j <= i)
j = i + generator.nextInt(wordLen - i);
}