A high-precision method for measuring high counting rates of ionizing-radiation detectors