fast_irandom(): Fix an off-by-one error in case of max=2^n