void setup(){
size(800,600);
background(0);
fill(255,40,40);
noStroke();
ellipse(400,80,20,20);
ellipse(150,513,20,20);
ellipse(650,513,20,20);
fill(255);
frameRate(10);
}
float traceX = 350;
float traceY = 350;
String vertexPick = "";
float rand = 0;
void draw(){
point(traceX,traceY);
rand = random(1);
if (rand > 2/3) {
vertexPick = "A";
}
else if (rand < 1/3) {
vertexPick = "B";
} else {
vertexPick = "C";
}
if (vertexPick == "A") {
traceX = (traceX+400)/2;
traceY = (traceY+80)/2;
}
else if (vertexPick == "B") {
traceX = (traceX+150)/2;
traceY = (traceY+513)/2;
}
else
{
traceX = (traceX+650)/2;
traceY = (traceY+513)/2;
}
}
I've checked, and every time through the 'draw' function it is generating a new random number between 0 and 1. But instead of assigning vertexPick to a new letter based on the number, it gets stuck on one value of vertexPick and stays there forever. Can anyone tell me why? Why would it not execute the if statement again on every loop?