So I’m working on a display full of triangles. I want to use keyPressed to get random colors for each triangle after I press a key, but unfortunately it doesn’t work (not even when I put it in the void draw). Does anyone have a solution?

My code:

```
void setup(){
size(800,800);
background(0,0,0);
smooth();
}
int x = 25;
int y = -150;
int count =0;
int value = 0;
void draw(){
for (int i=0; i <= 16; i++) {
y += 100;
x = 25;
if(count % 2 != 0){
for (int j = 0; j <= 16; j++) {
fill(random(0,250), random(0,250), random(0,250));
triangle(x-25, y, x, y+50, x+25, y);
fill(random(0,250), random(0,250), random(0,250));
triangle(x-25, y, x, y-50, x+25, y);
x += 50;
}
count++;
}
x = 0;
if(count % 2 == 0){
y += 50;
for (int j = 0; j <= 16; j++) {
fill(random(0,250), random(0,250), random(0,250));
triangle(x-25, y, x, y+50, x+25, y);
fill(random(0,250), random(0,250), random(0,250));
triangle(x-25, y, x, y-50, x+25, y);
x += 50;
}
count++;
y -= 50;
}
}
}
void keyPressed(){
if (keyPressed == true) {
fill(random(0,250), random(0,250), random(0,250));
}
}
```

**NOTE**: This Processing code belongs to R. Latify, 1st year Industrial Design at TU/e.