Light detection and ranging (lidar) systems use binary hypothesis tests to detect the presence of a target in a range interval. For systems that count photon detections, hypothesis test thresholds are normally set so that a target detection is declared if the number of detections exceeds a particular number. When this method is employed, the false alarm probability can not be selected arbitrarily. In this paper, a hypothesis test that uses randomized thresholds is described. This randomized method of thresholding allows lidar operation at any false alarm probability. When there is a maximum allowable false alarm probability, the hypothesis test that uses randomized thresholds generally produces higher target detection probabilities than the conventional (nonrandom) hypothesis test.