An optical rangefinder based on time-of-flight measurement, radiates pulsed light toward an object (70), and receives reflected light from the object, the receiver operating in a photon counting mode, so as to generate a pulse for a detected photon. There is a variable probability of a photon detection on the receiver, and a controller (370, 380, 390; 365, 470, 475, 380, 390; 570, 580, 590, 390) controls the photon detection probability of the receiver, based on a light level. By controlling the detection probability according to a light level, the receiver can have an increased dynamic range, and without the expense of using optical components. This can apply even while detecting very weak signals since the receiver can still be in a photon counting mode while the detection probability is controlled. The light level can be indicated by an output of the receiver itself, or by another detector external to the receiver.