I’m trying to solve an exercise, that i have to do a line, with for cycle. I need that it looks like this
6
8
9
3
1
but the only thing that I have is multiple numbers, in the same place, multiple times. I don’t know how to pick different random numbers every time the cycle for runs only once, and not every time the void draw read the code. I understand that the random function it’s inside the void draw, but, if I put it into the void setup, it only choose all the times the same number, like this:
2
2
2
2
2
the code that I am using, is this, hope someone can help me and fix it
int tam = 25;
int valAnterior;
void setup(){
size(600,400);
textSize(tam);
}
void draw(){
background(200);
for(int i=1; i<6; i++){
text(valAnterior, width/5, i*tam);
valAnterior = round(random(0,9));
}
}