Quantum Random Number Generator

Quantum Random Number Generator

Last updated:

0 purchases

Quantum Random Number Generator Image
Quantum Random Number Generator Images
Add to Cart

Description:

This repository provides a Quantum Random Number Generator (QRNG) that uses quantum computing to generate truly random integers between 0 and a specified maximum. It can operate locally with simulated quantum computing or remotely using IBM Q Experience for authentic quantum backend operations.

Features:

  1. Quantum Randomness: Utilizes quantum properties to generate random numbers, offering true randomness compared to traditional pseudorandom algorithms.
  2. Simulated and Real Quantum Backend: Supports both a simulated environment and a real remote quantum computer via IBM Q Experience.
  3. Configurable Output: Generates random integers up to a user-defined maximum value.
  4. Automatic Power-of-Two Adjustment: Automatically adjusts the maximum value to the nearest power of two for efficient quantum computation.
  5. Queue Management: Handles queued instructions for the IBM Q 5 Tenerife quantum computer.
  6. Credit Management: Monitors IBM Q Experience credit usage and resets on successful runs.

Requirements:

  • Python: Version 3.5 or later.
  • Dependencies: Listed in requirements.txt.
  • IBM Q Experience Account (for real quantum backend usage):
    • Create an account at IBM Q Experience.
    • Generate an API token from the "My Account -> Advanced" section.

Instructions:

  1. Clone the repository:

     

    bash

    Copy code

    git clone <repository_url> cd <repository_name>

  2. Install dependencies:

     

    bash

    Copy code

    pip install -r requirements.txt

  3. (Optional) Use Virtual Environment:

     

    bash

    Copy code

    python -m venv venv source venv/bin/activate pip install -r requirements.txt


Usage

Local Simulation

To generate a random number locally:

 

bash

Copy code

python ./main.py [max]

  • Replace [max] with the desired maximum integer.
  • Example:
     

    bash

    Copy code

    $ python ./main.py 12 Rounding input 12 to next power of 2: 16 9

Remote Quantum Backend

To generate a random number using IBM Q Experience:

  1. Obtain your API token from IBM Q Experience.
  2. Run the script:
     

    bash

    Copy code

    python ./main.py -remote --qx-token <your-token> [max]

    Example:
     

    bash

    Copy code

    python ./main.py -remote --qx-token abc123def456 15

  3. Note:
    • Execution on IBM's backend may take 10-20 minutes.
    • Maximum number supported is 33,554,431 (25 bits) per run.

Help

For additional options and usage instructions:

 

bash

Copy code

python ./main.py -h


Notes on IBM Q Credits

  • Free accounts provide 15 credits per run.
  • Each loop consumes 3 credits.
  • Credits are replenished after a successful run or reset daily.
  • Ensure sufficient credits for generating numbers requiring multiple loops.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.