The recent development of perovskite photonic devices has had significant impacts in many fields due to their optical properties and low-cost fabrication1,2. Perovskites kick-started a revolution as the building material for efficient solar cells3, while more recently they are also showing great promise for the fabrication of efficient light-emitting diodes (LEDs)4. Perovskite LEDs (PeLEDs) that operate at room temperature have already been developed5, opening up the path for practical perovskite-based light sources. These devices have the potential to be a game changer in fields such as next-generation displays6, general-purpose lighting7 and optical communications8, because PeLEDs possess narrow emission width and widely tunable bandgap, further motivating their use as practical devices2,6. Another key advantage is that the fabrication process of perovskite devices can be solution-processed under ambient conditions, for example through spin-coating or inkjet printing. This allows the: (i) integration of perovskite photonics with complementary metal-oxide semiconductors without relying on epitaxial growth and opens up for emerging technologies in wearable, implantable and portable electronics; and (ii) a simpler manufacturing process, which is highly attractive due to a lower associated cost9,10. Finally, recent results show advantages in the life cycle assessment of perovskite photovoltaic cells compared with a silicon benchmark in terms of reduced energy payback time and reduced greenhouse gas emission factor11,12, thus pointing out that PeLEDs might also have similar advantages in their life cycle assessment when compared with standard semiconductor solid-state devices, already pointing towards a more sustainable photonics industry.

The field of quantum information is largely dependent on technological advances provided by other areas in engineering and natural sciences. We have known for decades that the use of quantum systems for information processing opens up previously unreachable results such as carrying out some computation tasks under practical time13 and the demonstration of the non-local behaviour of nature14. However it was not until very recently that experimental demonstrations of a quantum advantage in computing15,16 and conclusive non-locality tests17 could be demonstrated. Major advances pushing forward many new applications in photonic quantum technologies include highly efficient single-photon detectors18, integrated photonic circuits19 and novel optical fibre designs20. Some preliminary efforts have been made in order to use perovskite devices for quantum optics21,22. However, perovskite-based devices are yet to be demonstrated in a complete quantum information processing task.

In our work we employ a metal-halide PeLED as the light source for a quantum random number generator (QRNG), providing a radical departure from the usual approach where solid-state light sources are usually employed (semiconductor LEDs or lasers) in quantum technology applications. The generation of random numbers based on the outputs from measurements of quantum systems is highly attractive for practical applications, due to the unavoidably random nature of quantum processes23. These numbers are used for a wide variety of applications, from encryption, on-line gaming and gambling, to computer simulations. Here we are able to produce a high-quality stream of random numbers from projective measurements on weak coherent polarisation states produced from the PeLED. The random bits are certified by the widely adopted National Institute of Standards and Technology (NIST) randomness test suite24. Simultaneously, we resort to the measurement device-independent (MDI)25 approach to certify the amount of private randomness that our system can produce in the hypothetical case that our detectors could be compromised by an eavesdropper. The MDI approach is of high relevance for QRNGs as the detectors are the devices that are most prone to being hacked by side-channel attacks26. Our demonstration on the use of PeLEDs for quantum information processing can enable future developments in quantum technologies with perovskite light sources.


Intuitively, randomness is associated with the difficulty of characterising the evolution of all the parameters leading to a given complex process. This is the basic concept behind many commercial random number generators. Nonetheless, from a more stringent perspective of cryptography, it is desired that the privacy of the generated randomness can be certified even against an eavesdropper that has some extra knowledge of the device inner-workings and infinite computational power to analyse the data generated27. This is only possible within the framework of quantum mechanics while exploiting the intrinsic randomness of the results of a quantum measurement28. QRNGs are usually classified in terms of the amount of assumptions needed by the user to guarantee the privacy of the generated random bits against a malicious eavesdropper. QRNGs based on the modern device-independent (DI) approach provide the ultimate level of security, guaranteeing private randomness even against an eavesdropper that has fabricated the device itself29,30,31,32,33,34. However, the requirements are quite demanding and they can only achieve modest random number generation rates. On the other end of the security spectrum lie standard device-dependent (DD) QRNGs that are capable of producing high random bit generation rates, but where full characterisation of the entire system is needed35,36,37,38,39. Solutions based on reasonable assumptions about partial knowledge of the device, the so-called semi-device-independent (SDI) approaches40, are the new trend for randomness generation as a high output throughput can be achieved with a higher level of security compared to traditional QRNGs41,42,43,44,45,46,47,48,49,50,51,52. Another important class of QRNGs is based on homodyne detection which are capable of ultra-high randomness generation rates and have also been demonstrated in both DD53,54 and SDI55,56,57 classes.

These quantum random number generators represent an important breakthrough in physics and are strong contenders to replace the ones being used today in industry and academia. Nonetheless, this will only be possible if they are made compact, have low manufacturing cost, and can be integrated with other systems. If they are to be mass-produced, then the environmental footprint also becomes important. The use of PeLEDs for building modern QRNGs is highly relevant since they can already satisfy some of these requirements. We gather the generated raw bitrate of the previously mentioned QRNGs in Fig. 1, separated by security class, showing clearly that our result is already highly competitive.

Fig. 1: Raw random bit generation rate of several quantum random number generators as a function of published year.
figure 1

The results are limited to those that employed single-photon detectors and are based on discrete variable quantum systems for direct comparison purposes. Our maximum sustained raw bit rate is 10.35 Mbit s−1.

The highly secure measurement-device independent (MDI) QRNG protocol, which belongs to the SDI class, can remarkably certify private randomness even in the case that the detectors are under the control of an eavesdropper25,40. In the MDI scenario, a user in need of random numbers possesses a characterised state preparation device (P) but has to use an untrusted measurement device (M) (Fig. 2a). This scenario has become of upmost practical relevance nowadays, as a side-channel attack to the detectors is the most common strategy for hacking quantum technologies26. The basic idea is that P now works actively, by randomly preparing different states. One of the states is conventionally used for randomness generation, while the others will be used to check the measurement device. The randomness generation rate is only slightly affected because the testing states can be chosen seldom, and most of the experimental run will still be used for randomness generation. For instance, in our case the state \(1/\sqrt{2}(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle +i\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle )\) is used for randomness generation and the states \(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle\) and \(\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle\) will be the testing ones. Whenever the state \(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle\) (\(\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle\)) is sent, only detector D1 (D2) should fire. Remarkably, from the success probabilities of recording the test states one can put an upper bound on the knowledge an eavesdropper can have about the generated random bit sequence. Formally speaking, and assuming the notation of48, the preparation device is used to randomly prepare a state of a set, {ωx}, with x = {0, 1, 2}, which are measured by M, resulting in an outcome a. After several iterations, one estimates the probabilities p(aωx). The maximal probability Pg(x*) of the eavesdropper guessing the outcome a for a given input x*, compatible with p(aωx), is given by the solution to a simple numerical optimisation program defined in25,48. Note that the eavesdropper aside of having control of the detectors, is allowed to even resort to quantum entanglement for guessing the outcomes a48. Finally, the amount of private randomness that is certified per experimental round in the MDI scenario is given by the min-entropy: \({{{{{{{{\mathcal{H}}}}}}}}}_{\min }({x}^{* })=-{\log }_{2}{P}_{{{{{{{{\rm{g}}}}}}}}}({x}^{* })\).

Fig. 2: Experimental setup and perovskite light emitting diode (PeLED) structure.
figure 2

a Scheme of our measurement-device-independent quantum random number generator. On the left the preparation stage (P) creates the quantum states to be prepared depending on the user’s choice of test or randomness generation states, while a measurement stage (M) produces the outputs “0” or “1” for each measurement round. The PeLED is housed inside the preparation stage, where it is used to produce weak coherent states. When the user decides to generate a random number, the superposition state \(\left\vert {{{{{{{\rm{R}}}}}}}}\right\rangle =1/\sqrt{2}(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle +i\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle )\) is prepared with a fixed linear polariser followed by a liquid crystal waveplate. In order to verify the functioning of the measurement device, the user randomly chooses to prepare one of the test states \(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle\) or \(\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle\) by electrically controlling the retardance of the waveplate. In our implementation the measurement device consists of an uncharacterised polarising beam splitter (PBS), which in principle should project the incoming states onto the orthogonal states \(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle\) and \(\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle\). The outputs of the PBS are connected to single-photon detectors D1 and D2. The outcomes “0” or “1” of (M) are read by field programmable gate array (FPGA) electronics. b The structure of the employed perovskite diodes, with the biasing circuit indicated. The structure shows the stackup of ITO/Glass (indium tin oxide), ZnO/PEIE (polyethylenimine ethoxylated zinc oxide), perovskite, TFB/MoOx (poly(9,9-dioctylfluorene-co-N-(4-butylphenyl)diphenylamine/molybdenum oxide)) and gold (Au). c Close-up photo of one of the PeLED samples mounted on an opto-mechanical mount. A coin worth one Swedish Crown (SEK) placed as a size reference.

Perovskite LED device

The structure of our PeLED is based on an indium tin oxide (ITO)-coated glass substrate (Fig. 2b, c). The active layer consists of formamidinium lead iodide perovskite, with approximately 50 nm thickness. This layer is sandwiched between the electron and hole transport layers which consist of polyethylenimine ethoxylated (PEIE)- modified zinc oxide (ZnO) and poly(9,9-dioctylfluorene-co-N-(4-butylphenyl)diphenylamine) (TFB) (~40 nm). They are followed by layers of molybdenum oxide (MoOx) (~7 nm) and gold (~80 nm) as the contact layer. In order to obtain highly stable PeLEDs, we used an additive of pimelic acid (PAC)58. Under forward bias, electrons and holes injected into the perovskite layer recombine, efficiently generating photons with a central wavelength of 804 nm, with a spectral width of 41.6 nm full-width at half-maximum with a peak external quantum efficency of around 18% (see Supplementary Notes 13 for further details).

MDI-QRNG Experiment

Our MDI-QRNG is schematically depicted in Fig. 2a. For each measurement round, the user chooses whether to prepare and send the test states, represented by horizontal or vertical polarisation states (\({\omega }_{0}=\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle\) and \({\omega }_{1}=\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle\)), or a linear superposition of both test states ([\({\omega }_{2}=\left\vert {{{{{{{\rm{R}}}}}}}}\right\rangle =1/\sqrt{2}\left.\right(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle\) +i\(\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle\))] as the random number generation state. The states are produced from weak coherent states of light generated by the PeLED, which is housed in the preparation stage. A linear polariser is employed to filter out the unpolarised light produced by the PeLED before passing through a liquid crystal waveplate (LCWP) with a switching time of less than 50 ms, which is the element employed by the user to implement the choice of ωx. A ball lens with 50 mm focal length is used to collimate the light emitted from the PeLED, and a calibrated optical attenuator is needed to adjust the mean photon number per detection window, such that the probability to have multi-photon events at the single-photon detectors is negligible ( < 0.28%). Both components are omitted for the sake of simplicity. In the MDI framework, the measurement stage is considered as a black box, which is able to output a signal “0” or “1” depending on the measurement result. Nothing else needs to be assumed about the measurement procedure to certify the privacy of the generated random numbers. In our implementation, the projection of the prepared states is done with an uncharacterised polarising beam splitter (PBS), which in principle should have the horizontal (\(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle\)) and vertical (\(\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle\)) polarisation states associated to the output signals “0” and “1”, respectively (see Fig. 2a). The measurement procedure is concluded with silicon single-photon avalanche detectors D1 and D2 (Perkin Elmer), with 25% overall detection efficiency at 800 nm. The output “0” or “1” of the measurement stage is registered by field programmable gate array (FPGA) electronics, whose output is then continuously streamed to a personal computer for storage and randomness extraction (see Methods). In the event that neither detector records the presence of a photon (for example due to absorption), that detection event is discarded and not stored. Similarly, if both detectors record the presence of a photon (either from noise in the detectors, from photons from the environment that couple to the fibres, or from multiphoton events) that detection event is also discarded.

In our experiment, before each measurement data block, a decision is randomly taken on whether that block will be used for randomness generation or to test the measurement device, as required in the MDI QRNG protocol48. For demonstration purposes in our experiment, the user choice is provided by an external software-based random number generator, with a bias of 99% towards randomness generation mode. In more sensitive applications, the user needs to have a trusted low-rate source of randomness, or use a small fraction of bits generated as feedback for the choice of measurement block type, while also saving some bits for a new session. Please note that any source of randomness may be used, even the partial output of a previous run or another source the user trusts. In Fig. 3 we display the raw bit generation rate as a function of elapsed time of the experiment, where one can see that it attains a remarkably high maximal value of 10.35 Mbit s−1 between days 2 and 8 approximately, and an average of 9.01 ± 1.30 Mbit s−1 over the entire run. We observe stable performance approximately in the first 8 days, and then a slow decay due to degradation of the PeLED, with a constant current density applied of 0.24 mA cm−2. Nevertheless after 22 days, the PeLED still has more than half of its original brightness. We also display the success probabilities recorded for either the \(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle\) or \(\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle\) test states, when activated by the user, during the whole measurement run. Please note that the user switches seamlessly between the transmitted states with the liquid crystal waveplate. The overall random number generation rate does not suffer a penalty, since the test states are only used 1% of the time. In spite of the fact the emission rate from the PeLED deteriorates, there is no change in the success probability for the test states, showing there is no change in the certification of the privacy of the random numbers generated. The difference for the measured probabilities between both states, is from the different transmission/reflection coefficients of the polarising beam splitter in the M stage. The average success probability for the entire generated random bit sequence is Psuc = 0.97 ± 0.01. This places an upper bound on the randomness generated per experimental round that is certified to be private against detector side-channel attacks. In our particular implementation it corresponds to \({{{{{{{{\mathcal{H}}}}}}}}}_{\min }=0.71\pm 0.01\) random bits, which is quite high considering the innovative aspects of our QRNG.

Fig. 3: Performance of the quantum random number generator with a perovskite light emitting diode (PeLED).
figure 3

Random number generation rate as a function of elapsed experiment time. Each blue dot corresponds to the average rate over 6 hours, and we obtain an overall average of 9.01 ± 1.30 Mbit s−1, with a maximum sustained rate of 10.35 Mbit s−1. Also shown are the probabilities to measure either the \(\left\vert {{{{{{{\rm{H}}}}}}}}\right\rangle\) or \(\left\vert {{{{{{{\rm{V}}}}}}}}\right\rangle\) test states, as required to test of the measurement device in the MDI protocol. Each test state is randomly chosen by the user with a 0.5% chance at the beginning of every measurement block. The insets show a higher time resolution sample of each test state data. Error bars come from assuming Poissonian statistics of the PeLED photon number distribution combined with the detection process.

Randomness assessment

Following the Toeplitz randomness extraction procedure we test the randomness of the final random bit key. Initially, we plot the first 0.5 Mbit of the generated sequence as an image where every 8-bit grey-level pixel is encoded directly from the random sequence (Fig. 4a). We choose only a small subset in this example due to limitations in displaying the entire data as a single image with reasonable size. Nevertheless, one can clearly observe the randomness of the data as the figure is indistinguishable from noise. Then a randomly selected 5 Gbits of the entire generated random bit sequence is fed to the NIST randomness statistical test suite, a well-known benchmark for statistically certifying the randomness of a sequence24. The test suite consists of 16 tests (listed in Fig. 4b, c), and for each test the original sequence is divided into b blocks of equal size. A typical block size is 1 million bits, which we have employed. The test result is a numerical value between 0 and 1 called a p-value, and a test is considered a pass if the corresponding result is above the confidence value of α = 0.01. Figure 4b shows the average of the p-values for all data blocks in each test with the corresponding standard deviation, clearly showing the generated sequence passes all tests. Furthermore in Fig 4c we plot the proportion of blocks in each test that passes with a p-value greater than 0.01. Also shown is the confidence level for the minimum proportion of tests that must pass in order to ensure randomness certification for the bit sequence (see “Methods”: Statistical testing).

Fig. 4: Quantum random number generation with perovskite light emitting diodes (PeLEDs).
figure 4

a Sequence of generated random bits (0.5 Mbit in length) plotted as an image, where each pixel has an 8-bit grey-scale colour depth. b Results of the NIST statistical test suite on 5 Gbits of the generated random sequence. Each of the sixteen tests of the suite is labelled on the x-axis, and on the y-axis is the numerical result for each test from 0 to 1, called the p-value. We employ a standard confidence value of 0.01, meaning a test is considered successful if its p-value above this number. Displayed are the average results of each test, with the standard deviation of the test results. c Here we plot the proportion r of passed runs within each test. The significance level for a test to be considered passed is shown in the graph as the dashed red line (“Methods”: statistical testing).


Perovskites have played a major role in the development of highly-efficient solar cells, thus greatly pushing solar power plants into becoming a major player in the production of electricity worldwide. The recent development of optoelectronic devices from perovskites is opening up the field of photonics for this material. PeLEDs are poised to have significant impacts in the areas of solid-state lighting and optical communications, with its lower carbon footprint during its entire life cycle as well as optical and mechanical properties being major motivators for their use. These properties are extremely attractive to the blooming field of quantum technologies, specifically aiming towards the widespread deployment of applications, even down to the consumer level. Following this direction, we have showed that PeLEDs can be successfully employed to implement modern and highly secure quantum random number generation protocols. Our results (Fig. 1) place our QRNG among the best reported, including commercial devices59, and thus show the feasibility of quantum technology systems with perovskite light sources, while also pointing towards initiatives to make the quantum technology industry more sustainable. We successfully demonstrated that the generated sequence passes the stringent NIST randomness test suite, a widely recognized benchmark employed for the certification of randomness in a sequence of numbers. At the same time, we have also guaranteed the privacy of at least 71% of the generated random numbers by implementing our QRNG with the MDI approach. We have obtained an operational lifetime of at least 22 days for the developed PeLED, given that the device had not yet quite reached half of its initial brightness. While this result is very high for a PeLED60, recent works have shown new solutions to further increase the operational stability61,62, thus showing a viable path for PeLEDs to be used in QRNGs for practical applications.


Randomness extractor and data streaming

The generated raw bit sequence is buffered in the FPGA in blocks of 216 bits before they are streamed over a UDP protocol to a host computer acting as server for final storage. The server then stores the acquired data for each of the different states separately to facilitate (i) security analysis, and (ii) randomness extraction. We then generate close to perfectly uniform sequences of numbers by applying a Toeplitz hashing extractor to the generated raw bits recorded for the experiment rounds where the prepared state was \(\left\vert {{{{{{{\rm{R}}}}}}}}\right\rangle\). We first split the raw binary sequence into N sequences of length n which we then multiply with an n × m Toeplitz matrix to generate an output of m hashed bits, following the procedure in63. Therefore we employ n = 400, and m is given by \(m={{{{{{{\mathcal{H}}}}}}}}-2{\log }_{2}\varepsilon\) where \({{{{{{{\mathcal{H}}}}}}}}=-{\log }_{2}[{\max }_{x\in {\{0,1\}}^{8}}\Pr \{X=x\}]\) is the minimum entropy when considering binary strings of length 8, and ε = 2−100 is a security parameter derived from the leftover hash lemma63.

The Toeplitz matrix T is defined at the beginning of the extraction procedure using a seed of n + m − 1 bits taken from the beginning of the raw sequence. These bits specify the elements of the first row and column of the matrix. As T can be reused for each of the subsequences, we obtain the final extracted sequence by concatenation of the results of the matrix multiplications Tn1, Tn2, . . . , TnN, where the subscript indicates the sequence number63,64.

Statistical testing

For each of the tests in the NIST 800-22 suite we compute the proportion r of sequences that yielded a p-value greater than the significance level α = 0.0124. We employ a confidence interval for the proportion of passed tests as \(r\pm 3\sqrt{\frac{\alpha (1-\alpha )}{b}}\), as defined in24, where b = 5000 is the number of sequences fed to the test. This results in a confidence interval of 0.9858 ≤ r ≤ 0.9942, where we consider a test passed if the proportions of sequences with p values piα fall within the interval.