摘要:The intrinsic unpredictability of measurements in quantum mechanics can be used to produce genuine randomness. Here, we demonstrate a random number generator where the randomness is certified by quantum contextuality in connection with the Kochen-Specker theorem. In particular, we generate random numbers from measurements on a single trapped ion with three internal levels, and certify the generated randomness by showing a bound on the minimum entropy through observation of violation of the Klyachko-Can-Binicioglu-Shumovsky (KCBS) inequality. Concerning the test of the KCBS inequality, we close the detection efficiency loophole for the first time and make it relatively immune to the compatibility loophole. In our experiment, we generate 1 × 105 random numbers that are guaranteed to have 5.2 × 104 bits of minimum entropy with a 99% confidence level.