Uhm sorry Aeluned you are quite wrong and M4C6YV3R is correct the line
int col = 1.0 * rand () / RAND_MAX ;
will for the most part producs 0 as its output.
Try it out
heres a quick test to prove this with output
for (int i= 0;i <= 20; i++){
int col = 1.0 * rand () / RAND_MAX ;
float colf = 1.0 * rand () / RAND_MAX ;
printf( " Col = %d , colf = %f
" , col, colf );
}
As you can see col is always Zero
output is:
Col = 0 , colf = 0.563585
Col = 0 , colf = 0.808740
Col = 0 , colf = 0.479873
Col = 0 , colf = 0.895962
Col = 0 , colf = 0.746605
Col = 0 , colf = 0.858943
Col = 0 , colf = 0.513535
Col = 0 , colf = 0.014985
Col = 0 , colf = 0.364452
Col = 0 , colf = 0.165899
Col = 0 , colf = 0.445692
Col = 0 , colf = 0.004669
Col = 0 , colf = 0.377880
Col = 0 , colf = 0.571184
Col = 0 , colf = 0.607166
Col = 0 , colf = 0.663045
Col = 0 , colf = 0.352123
Col = 0 , colf = 0.607685
Col = 0 , colf = 0.802606
Col = 0 , colf = 0.301950
Col = 0 , colf = 0.726676
Solution here is to change col from an int to float