With the wide application of lidar in the future, the problem of crosstalk between lidars will become more serious. True random coding photon counting lidar with high anti-crosstalk ability will play an important role in solving this problem. In this paper, based on the working principle of Gm-APD, the detection probability theoretical model of true random coding photon counting lidar is built, and the impact of jitter on detection probability is considered for the first time. The influence of mean echo photon number, mean pulse count density, sequence length and pulse width on detection probability is analyzed. Monte Carlo simulation and experimental results are highly consistent with the theoretical model, which proves the correctness of the detection probability theoretical model. This theoretical model provides an effective means to evaluate the system performance.