Holy shit dude that's some extremely overkill code.
Just do the following:
(note indents are messed up for whatever reason.)
public void randomKey() throws InterruptedException{
int random_length = random(n);
// put the length you want your names to go up to as n
for (int i = 0; i < random_length; i=i+1){
int X = random(48, 90);
getKeyboard.pressKey(x);
sleep(random(x,y);
}
}
The following code will randomly generate a value from 0-9, a-z (Key codes 48 -> 90) and then loop for the max length you wish your name to be. In the loop it will type random characters that it generates.
That should put you on the right lines. Don't believe you have to releaseKey() either when typing. I might be mistaken however and referring to another function.