Skip to main content

A Quantum Random Number Generator using IBM's Qiskit

Project description


qRNG is a python package that generates truly random numbers via quantum mechanics. It does this by using IBM's QISKit API to communicate with any one of their 3 publicly accessible quantum computers.

Installation

You can use the pip package manager to install the current release of qRNG (along with its dependencies):

pip install qrng

Upgrading is as simple as:

pip install qrng -U

What is Random Number Generation?

There are a variety of applications that require a source of random data in order to work effectively (e.g. simulations and cryptography). To that end, we make use of random number generators (RNGs) to generate sequences of numbers that are, ideally, indistinguishable from random noise.

There are two types of RNGs: Pseudo-RNGs (PRNGs) and True RNGs (TRNGs). Pseudo-RNGs, while not truly and statistically random, are used in a variety of applications as their output is 'random enough' for many purposes.

For a True RNGs, however, an actual piece of hardware is required to measure some random process in the real world as no deterministic computer program could suffice. These devices vary from pieces of radioactive material connected via USB to apparatuses that measure atmospheric noise.

Why Quantum?

Modern physics has shown us that there are really only two types of events that can happen in the universe: the unitary transformation of a quantum system, and quantum wavefunction collapse (i.e. measurement). The former being a totally deterministic process and the latter being a random one.

Indeed, all randomness in the universe (as far we know) is the result of the collapse of quantum systems upon measurement. In a sense, this is randomness in its purest form and the underlying source of it in any TRNG.

The point of this package then, besides it being a fun side project, is to cut out the middle man entirely, whether it be a radioactive isotope or the thermal noise in your PC, and simply measure an actual quantum system. For example, we can prepare the following state in a quantum computer:

There is a 50-50 chance of measuring the above state as a 0 or 1 and we can continually iterate this process for as many random bits as we require.

Practicality

Of course, while the numbers generated from a quantum computer are amongst the most random, the practicality of connecting to one IBM's quantum computers for a large amount of said numbers is nonexistent. For most real world use cases that require such high-caliber random numbers, an off the shelf hardware RNG would suffice.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
qrng-0.1.1.1-py3-none-any.whl (16.4 kB) Copy SHA256 hash SHA256 Wheel py3
qrng-0.1.1.1.tar.gz (3.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page