Looping
in
Programming Questions
•
1 year ago
As per below:
void draw() {
for (int i = 0; i < 20; i++) {
drawLine(int(random(width)), int(random(height)),
int(random(7)), int(random(255)));
}
}
drawLine() is a function for drawing a line. I'm just wondering why once in this for() Loop it draws 20 random lines in correspondence to the i variable in the loop, since I see no relationship between the int i and the function at all. (The i variable is not operated or even visible in any way in the argument of the function)
Thanks for the heads up.
void draw() {
for (int i = 0; i < 20; i++) {
drawLine(int(random(width)), int(random(height)),
int(random(7)), int(random(255)));
}
}
drawLine() is a function for drawing a line. I'm just wondering why once in this for() Loop it draws 20 random lines in correspondence to the i variable in the loop, since I see no relationship between the int i and the function at all. (The i variable is not operated or even visible in any way in the argument of the function)
Thanks for the heads up.
1