I was writing a simple processing script that does an random boolean and counts how oft its 1 instead of 0.
then I added an counter of the total amount an random is done. i wanted to use that for claculating the percentage of the 1ns. anything works fine to this point. then I wanted to do the calculating. it shows 0 no matter what i do. the code goes like
bool r; //boolean for random
int t; //t fr true or 1
int f; //f for false or 0
int cnt; //cnt for total count
float p; //for the percentage
Void draw(){
r = int(random(2));
if (r==0){int(f++);}
if (r==1){int(t++);}
if (r<100){cnt++;}
p = t / cnt * 100; //calculating percentage.
text(p,10,100); //draws text on sceen at x=10 and y=100 but it always draws 0
}
Whats is wrong with that? What did I do wrong?