Quasi-periodic pulsation (QPP) is a common phenomenon in solar flares. Studying QPP is important to further our understanding of the physical processes operating in flares. However, detection of QPP is complicated by the presence of noise in flaring lightcurves. In this study, we apply the Bayesian-based Markov-Chain-Monte-Carlo (MCMC) technique to the QPP detection. We use MCMC to fit the Fourier power spectral density (PSD) profiles of flaring lightcurves, aiming to determine a quasi-periodic component by model comparison and test statistics. Two models fitting the PSD were compared: the first model consists of colored and white noise only, and the second model adds a spectral peak of a Gaussian shape representing a short-living oscillatory signal. To evaluate MCMC of the QPP detection, we test it on 100 synthetic signals with spectral properties similar to those observed in flares. Subsequently, we analyzed QPP events in 699 flare signals in the 1–8 Å channel recorded by the Geostationary Operational Environmental Satellite from 2010 to 2017, including 250 B-class, 250 C-class, 150 M-class, and 49 X-class flares. Approximately 57% X-class, 39% M-class, 20% C-class, and 16% B-class flares are found to show a strong evidence of QPP, whose periods range mainly from 6.2 to 75.3 s. The results demonstrate that QPP events are easier to detect in more powerful flares. The distribution of the detected QPP periods is found to follow a logarithmic normal distribution. The distributions in the four flare classes are similar. This suggests that the established distribution is a common feature for flares of different classes.