let c=[];
function setup(){
createCanvas(480,480);
background(220);
for(let i=0;i<24;i++){
c[i]=random(255);
}
}
function draw(){
for(let x=0;x<24;x++){
fill(c[x]);
rect(x*20,0,20,480);
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.min.js"></script>