Added check for fi_rate <= RAND_MAX. Temporary fix.