Need help on a short animation

so i had in mind to make spawn 3000 pac man at the same time in random (x;y) and i want them to go on the right. But when i try only one spawn in random(x;y) and he is nice going on the right but i can’t make spawn 3000 of them. Here’s the code where i only tried to make spawn 10 of them :

float[] x=new float[3000];
float[] y=new float[3000];

int r;
void setup() {
size(1000,1000);
noStroke();

for(int r=0 ; r<10 ; r+=1){

x[r]=random(1000);
y[r]=random(1000);

}
}
void draw() {
background(0);

x[r]+=1;
fill(255,255,0);
arc(x[r],y[r],20,20,0.52,5.76);

}

yes, you only draw 1, why not draw all?

int howMany = 50; // 3000

float[] x=new float[howMany];
float[] y=new float[howMany];

void setup() {
  size(500, 500);
  noStroke();
  for (int r=0; r<howMany; r++) {
    x[r]=random(500);
    y[r]=random(500);
  }
}

void draw() {
  background(0, 0, 50);
  fill(255, 255, 0);
  for (int r=0; r<howMany; r++) {
    fill(255, 255, 0);
    arc(x[r], y[r], 20, 20, 0.52, 5.76);
    fill(255, 0, 0);
    ellipse(x[r]+3, y[r]-5, 4, 4);
    x[r]+=1;
    // this could help:   if ( x[r] > width ) x[r] = 0;
  }
}


Thank you so much i’m new in processing and so i did not understand i have to put the loop “for” in draw and in the setup. And thx for being so fast to reply. I wish u a wonderfull day.