int squareCount = 100; ColorSquare squares[] = new ColorSquare[squareCount]; void setup() { size(512, 512); for (int i = 0; i < squares.length; i++) { float r = random(100); if (r < 10) { squares[i] = new ColorSquare(random(width), random(height), 100); } else if (r < 20) { squares[i] = new ColorSquare(random(width), random(height), 10); } else { squares[i] = new ColorSquare(random(width), random(height), random(25, 50)); } } } void draw() { background(255); for (int i = 0; i < squares.length; i++) { squares[i].update(); squares[i].render(); } }