Giter Site home page Giter Site logo

qiskit_rng's Introduction

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.

qiskit_rng's People

Contributors

jyu00 avatar nonhermitian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qiskit_rng's Issues

Failed run on the example code

Information

  • Qiskit RNG version: 0.2.1
  • Python version: 3.8.3
  • Operating system: Mac OS 10.15.7

What is the current behavior?

running the example code:

from qiskit import IBMQ
from qiskit_rng import Generator

IBMQ.load_account()
rng_provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')
backend = rng_provider.backends.ibmq_ourense

generator = Generator(backend=backend)

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

I get the exception:

IBMQManagedResultDataNotAvailable: 'Results cannot be combined since some of the jobs failed.'

and checking on the quantum experience GUI in the Last Results panel I got the following exit status related to jobID generated by the execution.

image

Steps to reproduce the problem

What is the expected behavior?

Suggested solutions

Archive this repository

What is the expected enhancement?

Random number generation APIs are being de-provisioned. We should archive this repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.