My random function always returns a "1" rather than... anything
It is supposed to return a "0" or "1"
int rnd() {
unsigned int num0 = rand();
if(num0 < 32767.5) {return 0;}
if(num0 > 32767.5) {return 1;}
}
int chk;
bool _True = true;
int main(void) {
while(_True) {
chk = rnd();
printf("%i\n", chk);
//if(chk == 1) {printf("%i\n", chk); _True = false;}
//if(chk == 0) {printf("%i\n", chk); _True = false;}
}
}
Aucun commentaire:
Enregistrer un commentaire