Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Qiskit Random Number Generation

License Build Status

Qiskit is an open-source framework for working with noisy intermediate-scale quantum computers (NISQ) at the level of pulses, circuits, and algorithms.

This project contains support for Random Number Generation using Qiskit and IBM Quantum Experience backends. The resulting raw numbers can then be passed to Cambridge Quantum Computing (CQC) randomness extractors to get higher-quality random numbers.

Installation

You can install the project using pip:

pip install qiskit_rng

PIP will handle all python dependencies automatically, and you will always install the latest (and well-tested) version.

Usage

Setting up the IBM Quantum Provider

You will need setup your IBM Quantum Experience account and provider in order to access IBM Quantum backends. See qiskit-ibmq-provider for more details.

Generating random numbers using an IBM Quantum backend

To generate random numbers using an IBM Quantum backend:

from qiskit import IBMQ
from qiskit_rng import Generator

IBMQ.load_account()
rng_provider = IBMQ.get_provider(hub='MY_HUB', group='MY_GROUP', project='MY_PROJECT')
backend = rng_provider.backends.ibmq_ourence

generator = Generator(backend=backend)
output = generator.sample(num_raw_bits=1024).block_until_ready()
print(output.mermin_correlator)

The output you get back contains useful information such as the Weak Source of Randomness (result.wsr) used to generate the circuits, the resulting bits (result.raw_bits), and the Mermin correlator value (result.mermin_correlator).

Using CQC extractors to get highly random output

If you have access to the CQC extractors, you can feed the outputs from the previous step to obtain higher quality random numbers:

random_bits = output.extract()

The code above uses the default parameter values, but the extractor is highly configurable. See documentation for some use case examples and parameter suggestions.

Documentation

Usage and API documentation can be found here.

License

Apache License 2.0.

Metadata

Release files for qiskit-rng 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qiskit-rng 0.2.2
File Size Uploaded
qiskit_rng-0.2.2.tar.gz 14.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qiskit-rng 0.2.2
File Interpreter ABI Platform
qiskit_rng-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.0 kB

Release files / qiskit_rng-0.2.2.tar.gz

Download URL qiskit_rng-0.2.2.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
88e010c2b7d29dc51672717f8bce7d662b50e3ee120ac6e91b592a2add2cef4d
BLAKE2b-256 checksum
How to use checksums
d7418e685e16034b5960d2c506202bea50cd08ea5087d65824ed2b25b9f8dbc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

Release files / qiskit_rng-0.2.2-py3-none-any.whl

Download URL qiskit_rng-0.2.2-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9effc6e2093b966497c8556cd14d220b6f25dace68093691effe55eb066f334b
BLAKE2b-256 checksum
How to use checksums
1cddb2b4385cfd99eb513d14421fc3c992a1dd5f5182e969be09342cda722d34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page