{"id":19246390,"url":"https://github.com/pedrorrivero/qrand","last_synced_at":"2025-10-25T02:07:08.634Z","repository":{"id":45941232,"uuid":"303870287","full_name":"pedrorrivero/qrand","owner":"pedrorrivero","description":"A multiprotocol and multiplatform quantum random number generation framework","archived":false,"fork":false,"pushed_at":"2021-11-27T03:20:12.000Z","size":592,"stargazers_count":26,"open_issues_count":17,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-02T06:24:32.903Z","etag":null,"topics":["numpy","qrng-protocols","quantum-computing","random-number-generator"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/qrand/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pedrorrivero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-14T01:28:20.000Z","updated_at":"2025-03-30T13:34:24.000Z","dependencies_parsed_at":"2022-09-26T21:31:43.193Z","dependency_job_id":null,"html_url":"https://github.com/pedrorrivero/qrand","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/pedrorrivero/qrand","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrorrivero%2Fqrand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrorrivero%2Fqrand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrorrivero%2Fqrand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrorrivero%2Fqrand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pedrorrivero","download_url":"https://codeload.github.com/pedrorrivero/qrand/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrorrivero%2Fqrand/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263233670,"owners_count":23434889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["numpy","qrng-protocols","quantum-computing","random-number-generator"],"created_at":"2024-11-09T17:31:54.211Z","updated_at":"2025-10-25T02:07:08.512Z","avatar_url":"https://github.com/pedrorrivero.png","language":"Python","funding_links":[],"categories":["Quantum tools"],"sub_categories":[],"readme":"[![Unitary Fund](https://img.shields.io/badge/Supported_By-UNITARY_FUND-FFF000.svg?style=flat)](http://unitary.fund)\n[![YouTube](https://img.shields.io/badge/PR-qrand-FF0000.svg?style=flat\u0026logo=YouTube\u0026logoColor=white)](https://youtu.be/CG7BxuWFpME)\n[![PyPI](https://img.shields.io/pypi/v/qrand?label=PyPI\u0026style=flat\u0026color=3776AB\u0026logo=Python\u0026logoColor=white)](https://pypi.org/project/qrand/)\n[![Coverage](https://img.shields.io/badge/Coverage-47%25-orange.svg?style=flat)](http://pytest.org)\n[![Apache-2.0 License](https://img.shields.io/github/license/pedrorrivero/qrand?label=License\u0026style=flat\u0026color=1D1D1D)](https://github.com/pedrorrivero/qrand/blob/master/LICENSE)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4755731.svg)](https://doi.org/10.5281/zenodo.4755731)\n\n\n# qrand\n\n\u003e A multiprotocol and multiplatform quantum random number generation framework\n\nRandom numbers are everywhere.\n\nComputer algorithms, data encryption, physical simulations, and even the arts use them all the time. There is one problem though: it turns out that they are actually very difficult to produce in large amounts. Classical computers can only implement mathematical tricks to emulate randomness, while measuring it out of physical processes turns out to be too slow. Luckily, the probabilistic nature of quantum computers makes these devices particularly useful for the task.\n\nQRAND is a free and open-source framework for quantum random number generation. Thanks to its loosely coupled design, it offers seamlessly compatibility between different [quantum computing platforms](#supported-quantum-platforms) and [QRNG protocols](#implemented-qrng-protocols). Not only that, but it also enables the creation of custom cross-compatible protocols, and a wide range of output formats (e.g. bitstring, int, float, complex, hex, base64).\n\nTo boost its efficiency, QRAND makes use of a concurrent cache to reduce the number of internet connections needed for random number generation; and for quality checks, it incorporates a suite of classical entropy validation tests which can be easily plugged into any base protocol.\n\nAdditionally, QRAND introduces an interface layer for [NumPy](https://numpy.org/) that enables the efficient production of quantum random numbers (QRN) adhering to a wide variety of probability distributions. This is ultimately accomplished by transforming uniform probability distributions produced in cloud-based real quantum hardware, through NumPy's random module.\n\n```python3\nfrom qrand import QuantumBitGenerator\nfrom qrand.platforms import QiskitPlatform\nfrom qrand.protocols import HadamardProtocol\nfrom numpy.random import Generator\nfrom qiskit import IBMQ\n\nprovider = IBMQ.load_account()\nplatform = QiskitPlatform(provider)\nprotocol = HadamardProtocol()\nbitgen = QuantumBitGenerator(platform, protocol)\ngen = Generator(bitgen)\n\nprint(f\"Random Raw: {bitgen.random_raw()}\")\nprint(f\"Random Bitstring: {bitgen.random_bitstring()}\")\nprint(f\"Random Unsigned Int: {bitgen.random_uint()}\")\nprint(f\"Random Double: {bitgen.random_double()}\")\n\nprint(f\"Random Binomial: {gen.binomial(4, 1/4)}\")\nprint(f\"Random Exponential: {gen.exponential()}\")\nprint(f\"Random Logistic: {gen.logistic()}\")\nprint(f\"Random Poisson: {gen.poisson()}\")\nprint(f\"Random Std. Normal: {gen.standard_normal()}\")\nprint(f\"Random Triangular: {gen.triangular(-1, 0, 1)}\")\n# ...\n```\n\n## Supported quantum platforms\nAs of June 2021, QRAND supports [`Qiskit`](https://qiskit.org/) and [`Q#`](https://docs.microsoft.com/en-us/azure/quantum/user-guide/?view=qsharp-preview). However, support for [`Cirq`](https://quantumai.google/cirq) is under active development.\n\n## Implemented QRNG protocols\nAs of June 2021, both the basic `HadamardProtocol`, and the more sophisticated [`EntanglementProtocol`](https://www.nature.com/articles/s41598-019-56706-2) are available. We are also working on implementing a version of [Google's Sycamore routine](https://arxiv.org/abs/1612.05903) (patent permitting).\n\n## Authors and citation\nQRAND is the work of many people who contribute to the project at\ndifferent levels. If you use QRAND, please cite as per the included\n[BibTeX file](QRAND.bib).\n\n\u003c!-- ## Documentation --\u003e\n\n## Contribution guidelines\nIf you'd like to contribute to QRAND, please take a look at the\n[contribution guidelines](CONTRIBUTING.md). This project adheres to the following [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.\n\nWe use [GitHub issues](https://github.com/pedrorrivero/qrand/issues) for tracking requests and bugs. Please use Unitary Fund's [Discord](http://discord.unitary.fund/) for discussion and simple questions.\n\n## Acknowledgements\nParts of this software's source code have been inspired or borrowed from the [qRNG](https://github.com/ozanerhansha/qRNG) project, which is licensed under the [GNU GPLv3](https://github.com/ozanerhansha/qRNG/blob/master/LICENSE) license. Copyright notice and specific changes can be found as a docstring wherever this applies.\n\n## License\n[Apache License 2.0](LICENSE)\n\n---\n(c) Copyright 2021 Pedro Rivero\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrorrivero%2Fqrand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedrorrivero%2Fqrand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrorrivero%2Fqrand/lists"}