Another option is to choose a random point on a color spectrum using lerpColor()
and passing it two colors and a random value between 0-1.
https://processing.org/reference/lerpColor_.html
color from = color(204, 102, 0);
color to = color(0, 102, 153);
void setup() {
frameRate(1);
}
void draw() {
// random background in color range
color randc = lerpColor(from, to, random(1));
background (randc);
// draw color bar
for(int i=0; i<10; i++){
fill(lerpColor(from, to, i/10.0));
rect(0,0,10,10);
translate(10,0);
}
}