starArray[i][j]= new Star(i *10, j* 10);
you want random try random
https://processing.org/reference/random_.html
starArray[i][j]= new Star( random(0,width), random(0,height) );
or did you mean the array size ( number of stars ) need to be random?