pls look my code above:
for stop the for loop only use like
for (int i=0; i<many; i++) {
random_set(); // init random rect settings
if ( avoid_collide ) while ( collide(x, y, w, h) ) random_set(); // try again until not collide with existing
myrects.add(new MyRect(x, y, w, h)); // ok, make it and stop trying
println("i "+i+" x "+x+" y "+y+" w "+w+" h "+h);
i = many;
}
to stop the while need above shown timer and add boolean
( possibly there are better ways, just what i made here for this test )
and again i can not follow your 2 class things,
at the first look i have the idea that you do the grass2 array from a parent class and as a function of its own class, looks both very confusing for me.