Simple random string question

APOLOGIES

obviously, this is better:


int x;
int y;
String wordMy="";
int i=0;

void setup() {
  size(500, 500);
}

void draw() {
  x=int(random(25, 450));
  y=int(random(25, 450));
  textSize(25);
  fill(0);
  if (wordMy.length() > 0)  //!!!
    text(wordMy.charAt(i), 
      x, y);
  if ((frameCount % 10 == 0) && (i<wordMy.length()-1))  //!!!!
    i++;
}

void keyPressed() {
  wordMy+=key;
}

Also, we could say i=0; when i>=wordMy.length()-1
or say i=0; in keyPressed