int rectCount = 5; // syntax: // type variableName[] = new type[arrayLength] color rectColors[] = new color[rectCount]; void setup() { size(512, 200); randomizeColors(); } void draw() { background(255); noStroke(); rectMode(CENTER); float spacing = width / rectCount; float paddingLeft = spacing / 2; for (int i = 0; i < rectCount; i++) { fill(rectColors[i]); rect(paddingLeft + spacing*i, height/2, 50, 50); } } void randomizeColors() { for (int i = 0; i < rectColors.length; i++) { rectColors[i] = color(random(255), random(255), random(255)); } } void mousePressed() { randomizeColors(); }