C's rand() function returns an int >= 0, so rand() < 0.0001 will be true only when rand() returns zero. Assuming a pseudorandom number generator that uses all its possible values before repeating, you'll get a 0 approximately every 1 in RAND_MAX times you call rand().