Randomness is important for many information processing applications, including numerical modelling and cryptography1,2. Device-independent quantum random-number generation (DIQRNG)3,4 based on the loophole-free violation of a Bell inequality produces genuine, unpredictable randomness without requiring any assumptions about the inner workings of the devices, and is therefore an ultimate goal in the field of quantum information science5,6,7. Previously reported experimental demonstrations of DIQRNG8,9 were not provably secure against the most general adversaries or did not close the ‘locality’ loophole of the Bell test. Here we present DIQRNG that is secure against quantum and classical adversaries10,11,12. We use state-of-the-art quantum optical technology to create, modulate and detect entangled photon pairs, achieving an efficiency of more than 78 per cent from creation to detection at a distance of about 200 metres that greatly exceeds the threshold for closing the ‘detection’ loophole of the Bell test. By independently and randomly choosing the base settings for measuring the entangled photon pairs and by ensuring space-like separation between the measurement events, we also satisfy the no-signalling condition and close the ‘locality’ loophole of the Bell test, thus enabling the realization of the loophole-free violation of a Bell inequality. This, along with a high-voltage, high-repetition-rate Pockels cell modulation set-up, allows us to accumulate sufficient data in the experimental time to extract genuine quantum randomness that is secure against the most general adversaries. By applying a large (137.90 gigabits × 62.469 megabits) Toeplitz-matrix hashing technique, we obtain 6.2469 × 107 quantum-certified random bits in 96 hours with a total failure probability (of producing a random number that is not guaranteed to be perfectly secure) of less than 10−5. Our demonstration is a crucial step towards transforming DIQRNG from a concept to a key aspect of practical applications that require high levels of security and thus genuine randomness7. Our work may also help to improve our understanding of the origin of randomness from a fundamental perspective.

Access optionsAccess options

Rent or Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

Data availability

The data that support the findings of this study are available from the corresponding authors on reasonable request. Source Data for Fig. 3 is provided with the online version of the paper.

Additional information

Publisher’s note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.


  1. 1.

    Shannon, C. E. Communication theory of secrecy systems. Bell Labs Tech. J. 28, 656–715 (1949).

  2. 2.

    Metropolis, N. & Ulam, S. The Monte Carlo method. J. Am. Stat. Assoc. 44, 335–341 (1949).

  3. 3.

    Colbeck, R. Quantum and Relativistic Protocols for Secure Multi-party Computation. PhD thesis, Cambridge Univ. (2009).

  4. 4.

    Mayers, D. & Yao, A. Quantum cryptography with imperfect apparatus. In Proc. 39th Annual Symposium on Foundations of Computer Science (ed. Motwani, R.) 503–509 (IEEE, 1998).

  5. 5.

    Ma, X., Yuan, X., Cao, Z., Qi, B. & Zhang, Z. Quantum random number generation. npj Quantum Inf. 2, 16021 (2016).

  6. 6.

    Herrero-Collantes, M. & Garcia-Escartin, J. C. Quantum random number generators. Rev. Mod. Phys. 89, 015004 (2017).

  7. 7.

    Acín, A. & Masanes, L. Certified randomness in quantum physics. Nature 540, 213–219 (2016).

  8. 8.

    Pironio, S. et al. Random numbers certified by Bell’s theorem. Nature 464, 1021–1024 (2010).

  9. 9.

    Bierhorst, P. et al. Experimentally generated randomness certified by the impossibility of superluminal signals. Nature 556, 223–226 (2018).

  10. 10.

    Miller, C. A. & Shi, Y. Universal security for randomness expansion from the spot-checking protocol. SIAM J. Comput. 46, 1304–1335 (2017).

  11. 11.

    Vazirani, U. V. & Vidick, T. Certifiable quantum dice - or, testable exponential randomness expansion. Preprint at https://arxiv.org/abs/1111.6054 (2011).

  12. 12.

    Arnon-Friedman, R., Renner, R. & Vidick, T. Simple and tight device-independent security proofs. Preprint at https://arxiv.org/abs/1607.01797 (2016).

  13. 13.

    Hensen, B. et al. Loophole-free Bell inequality violation using electron spins separated by 1.3 kilometres. Nature 526, 682–686 (2015).

  14. 14.

    Shalm, L. K. et al. Strong loophole-free test of local realism. Phys. Rev. Lett. 115, 250402 (2015).

  15. 15.

    Giustina, M. et al. Significant-loophole-free test of Bell’s theorem with entangled photons. Phys. Rev. Lett. 115, 250401 (2015).

  16. 16.

    Rosenfeld, W. et al. Event-ready Bell test using entangled atoms simultaneously closing detection and locality loopholes. Phys. Rev. Lett. 119, 010402 (2017).

  17. 17.

    Vazirani, U. & Vidick, T. Fully device-independent quantum key distribution. Phys. Rev. Lett. 113, 140501 (2014).

  18. 18.

    Miller, C. A. & Shi, Y. Robust protocols for securely expanding randomness and distributing keys using untrusted quantum devices. J. ACM 63, 33 (2016).

  19. 19.

    Chung, K.-M., Shi, Y. & Wu, X. Physical randomness extractors: generating random numbers with minimal assumptions. Preprint at https://arxiv.org/abs/1402.4797 (2014).

  20. 20.

    Coudron, M. & Yuen, H. Infinite randomness expansion with a constant number of devices. In Proc. 46th Annual ACM Symposium on Theory of Computing (ed. Shmoys, D.) 427–436 (ACM, 2014).

  21. 21.

    Dupuis, F., Fawzi, O. & Renner, R. Entropy accumulation. Preprint at https://arxiv.org/abs/1607.01796 (2016).

  22. 22.

    Liu, Y. et al. High-speed device-independent quantum random number generation without a detection loophole. Phys. Rev. Lett. 120, 010503 (2018).

  23. 23.

    Clauser, J. F., Horne, M. A., Shimony, A. & Holt, R. A. Proposed experiment to test local hidden-variable theories. Phys. Rev. Lett. 23, 880–884 (1969).

  24. 24.

    Coudron, M., Vidick, T. & Yuen, H. Robust randomness amplifiers: upper and lower bounds. In Proc. APPROX 2013: Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (eds Raghavendra, P. et al.) 468–483 (Springer, 2013).

  25. 25.

    Barrett, J., Colbeck, R. & Kent, A. Memory attacks on device-independent quantum cryptography. Phys. Rev. Lett. 110, 010503 (2013).

  26. 26.

    Pereira, M. D. C. et al. Demonstrating highly symmetric single-mode, single-photon heralding efficiency in spontaneous parametric downconversion. Opt. Lett. 38, 1609–1611 (2013).

  27. 27.

    Eberhard, P. H. Background level and counter efficiencies required for a loophole-free Einstein-Podolsky-Rosen experiment. Phys. Rev. A 47, R747–R750 (1993).

  28. 28.

    Zhang, Y., Glancy, S. & Knill, E. Asymptotically optimal data analysis for rejecting local realism. Phys. Rev. A 84, 062118 (2011).

  29. 29.

    Kessler, M. & Arnon-Friedman, R. Device-independent randomness amplification and privatization. Preprint at https://arxiv.org/abs/1705.04148 (2017).

  30. 30.

    Bennink, R. Optimal collinear Gaussian beams for spontaneous parametric down-conversion. Phys. Rev. A 81, 053805 (2010).

  31. 31.

    Dixon, P. B. et al. Heralding efficiency and correlated-mode coupling of near-IR fiber-coupled photon pairs. Phys. Rev. A 90, 043804 (2014).

  32. 32.

    Zhang, W. et al. NbN superconducting nanowire single photon detector with efficiency over 90% at 1550 nm wavelength operational at compact cryocooler temperature. Sci. China Phys. Mechan. Astron. 60, 120314 (2017).

Download references


We thank S.-R. Zhao, Y.-H. Li, L.-K. Chen and R. Jin for experimental assistance, J. Zhong and S.-C. Shi for low-temperature system maintenance, and T. Peng, Y. Cao, C.-Z. Peng and Y.-A. Chen for discussions. This work was supported by the National Key R&D Program of China (2017YFA0303900, 2017YFA0304000), the National Natural Science Foundation of China, the Chinese Academy of Sciences and the Anhui Initiative in Quantum Information Technologies.

Reviewer information

Nature thanks R. Colbeck and the other anonymous reviewer(s) for their contribution to the peer review of this work.

Author information


  1. National Laboratory for Physical Sciences at Microscale and Department of Modern Physics, University of Science and Technology of China, Hefei, China

    • Yang Liu
    • , Ming-Han Li
    • , Jian-Yu Guan
    • , Bing Bai
    • , Wen-Zhao Liu
    • , Cheng Wu
    • , Xiao Yuan
    • , Jun Zhang
    • , Jingyun Fan
    • , Qiang Zhang
    •  & Jian-Wei Pan
  2. Shanghai Branch, CAS Center for Excellence and Synergetic Innovation Center in Quantum Information and Quantum Physics, University of Science and Technology of China, Shanghai, China

    • Yang Liu
    • , Ming-Han Li
    • , Jian-Yu Guan
    • , Bing Bai
    • , Wen-Zhao Liu
    • , Cheng Wu
    • , Xiao Yuan
    • , Jun Zhang
    • , Jingyun Fan
    • , Qiang Zhang
    •  & Jian-Wei Pan
  3. Center for Quantum Information, Institute for Interdisciplinary Information Sciences, Tsinghua University, Beijing, China

    • Qi Zhao
    • , Xiao Yuan
    •  & Xiongfeng Ma
  4. State Key Laboratory of Functional Materials for Informatics, Shanghai Institute of Microsystem and Information Technology, Chinese Academy of Sciences, Shanghai, China

    • Weijun Zhang
    • , Hao Li
    • , Zhen Wang
    •  & Lixing You
  5. NTT Basic Research Laboratories and NTT Research Center for Theoretical Quantum Physics, NTT Corporation, Atsugi, Japan

    • Yanbao Zhang
    •  & W. J. Munro


  1. Search for Yang Liu in:

  2. Search for Qi Zhao in:

  3. Search for Ming-Han Li in:

  4. Search for Jian-Yu Guan in:

  5. Search for Yanbao Zhang in:

  6. Search for Bing Bai in:

  7. Search for Weijun Zhang in:

  8. Search for Wen-Zhao Liu in:

  9. Search for Cheng Wu in:

  10. Search for Xiao Yuan in:

  11. Search for Hao Li in:

  12. Search for W. J. Munro in:

  13. Search for Zhen Wang in:

  14. Search for Lixing You in:

  15. Search for Jun Zhang in:

  16. Search for Xiongfeng Ma in:

  17. Search for Jingyun Fan in:

  18. Search for Qiang Zhang in:

  19. Search for Jian-Wei Pan in:


X.M., J.F., Q.Z. and J.-W.P. conceived the research. Y.L., X.M., J. F., Q.Z. and J.-W.P. designed the experiment. Y.L., M.-H.L. and C.W. designed and implemented the source of entangled photon pairs. W.-Z.L. and J.-Y.G. designed the data acquisition software. W.Z., H.L., Z.W. and L.Y. fabricated and characterized the superconducting nanowire single-photon detector. B.B. and J.Z. designed the quantum random-number generators for the measurement setting choices. Q. Zhao, X.Y. and X.M. performed the protocol analysis, numerical modelling and randomness extraction. Y.Z. and W.J.M. performed the hypothesis tests. All authors contributed to the experimental realization, data analysis and manuscript preparation. J.-W.P. supervised the project.

Competing interests

The authors declare no competing interests.

Corresponding authors

Correspondence to Xiongfeng Ma or Jingyun Fan or Qiang Zhang or Jian-Wei Pan.

Supplementary information

  1. Supplementary Information

    This file contains Supplementary Text, Supplementary Figures 1-6, and Supplementary Tables 1-7. The Supplementary Information describes the theory of DIQRNG (Section I), the experimental details (Section II), and the experimental results (Section III).

Source data

About this article

Publication history




Issue Date




By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.