I'm trying to pick a random color for strokeline from an array list. From the program, it indicates that random() expect parameter like random(float). But I feel a bit stuck of how to correct it. Below is my code:
int n = 200;
drop[] d;
color[] colors = {
#013a63,
#01497c,
#014f86,
#2a6f97,
#2c7da0,
#468faf,
#61a5c2,
#89c2d9,
#a9d6e5,
};
void setup() {
size(1080, 720);
stroke(random(colors));
d = new drop[n];
for(int i = 0; i < d.length; i ++) {
d[i] = new drop(random(width), random(-10, 20), random(5));
}
}
void draw() {
background(1, 42, 74,10);
for(int i = 0; i < d.length; i ++) {
d[i].show();
d[i].update();
}
}