Hi
I'd like to write a random number generator between 0 and1.
I'm doing like that:
but i get this output:Code:#include<stdio.h> #include <stdlib.h> #include <time.h> int main(){ int b; float r; srand(time(NULL)); printf("%d",RAND_MAX); for (b=11;b>0;b--){ r=rand(); printf("%f\n", r/RAND_MAX); } return 0; }
why the first one is not normalized?Code:21474836470.216477 0.471353 0.312465 0.644094 0.796645 0.112260 0.999378 0.374815 0.463826 0.021919 0.175329
Thanks
D.