quantum-random 1.3.2__tar.gz → 1.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {quantum-random-1.3.2 → quantum_random-1.4.1}/LICENSE +1 -1
- {quantum-random-1.3.2 → quantum_random-1.4.1}/PKG-INFO +32 -43
- {quantum-random-1.3.2 → quantum_random-1.4.1}/README.md +6 -9
- quantum_random-1.4.1/pyproject.toml +69 -0
- {quantum-random-1.3.2 → quantum_random-1.4.1}/src/qrandom/__init__.py +7 -0
- {quantum-random-1.3.2 → quantum_random-1.4.1}/src/qrandom/_api.py +1 -2
- quantum-random-1.3.2/.github/workflows/publish.yml +0 -26
- quantum-random-1.3.2/.github/workflows/tests.yml +0 -68
- quantum-random-1.3.2/.gitignore +0 -6
- quantum-random-1.3.2/analysis/README.md +0 -15
- quantum-random-1.3.2/analysis/generate_plot.py +0 -53
- quantum-random-1.3.2/analysis/random.png +0 -0
- quantum-random-1.3.2/analysis/requirements.txt +0 -3
- quantum-random-1.3.2/analysis/uniform.md +0 -21
- quantum-random-1.3.2/pyproject.toml +0 -64
- quantum-random-1.3.2/setup.cfg +0 -4
- quantum-random-1.3.2/src/qrandom/version.py +0 -4
- quantum-random-1.3.2/src/quantum_random.egg-info/PKG-INFO +0 -166
- quantum-random-1.3.2/src/quantum_random.egg-info/SOURCES.txt +0 -32
- quantum-random-1.3.2/src/quantum_random.egg-info/dependency_links.txt +0 -1
- quantum-random-1.3.2/src/quantum_random.egg-info/entry_points.txt +0 -2
- quantum-random-1.3.2/src/quantum_random.egg-info/requires.txt +0 -8
- quantum-random-1.3.2/src/quantum_random.egg-info/top_level.txt +0 -1
- quantum-random-1.3.2/tests/conftest.py +0 -120
- quantum-random-1.3.2/tests/data/fetch_data.py +0 -56
- quantum-random-1.3.2/tests/data/responses.json +0 -1
- quantum-random-1.3.2/tests/test_api.py +0 -184
- quantum-random-1.3.2/tests/test_cli.py +0 -100
- quantum-random-1.3.2/tests/test_generator.py +0 -89
- quantum-random-1.3.2/tests/test_numpy_support.py +0 -11
- quantum-random-1.3.2/tests/test_qrandom.py +0 -5
- quantum-random-1.3.2/tox.ini +0 -60
- {quantum-random-1.3.2 → quantum_random-1.4.1}/src/qrandom/_cli.py +0 -0
- {quantum-random-1.3.2 → quantum_random-1.4.1}/src/qrandom/_generator.py +0 -0
- {quantum-random-1.3.2 → quantum_random-1.4.1}/src/qrandom/numpy.py +0 -0
|
@@ -1,51 +1,43 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: quantum-random
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1
|
|
4
4
|
Summary: Quantum random numbers
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
License: Copyright 2023 Seto Balian
|
|
8
|
-
|
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
of this software and associated documentation files (the "Software"), to
|
|
11
|
-
deal in the Software without restriction, including without limitation the
|
|
12
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
13
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
furnished to do so, subject to the following conditions:
|
|
15
|
-
|
|
16
|
-
The above copyright notice and this permission notice shall be included in
|
|
17
|
-
all copies or substantial portions of the Software.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
20
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
22
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
23
|
-
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
24
|
-
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
25
|
-
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
-
|
|
27
|
-
Project-URL: homepage, https://github.com/sbalian/quantum-random
|
|
28
|
-
Project-URL: repository, https://github.com/sbalian/quantum-random.git
|
|
5
|
+
Home-page: https://github.com/sbalian/quantum-random/
|
|
6
|
+
License: MIT
|
|
29
7
|
Keywords: quantum,random,statistics
|
|
30
|
-
|
|
8
|
+
Author: Seto Balian
|
|
9
|
+
Author-email: seto.balian@gmail.com
|
|
10
|
+
Maintainer: Seto Balian
|
|
11
|
+
Maintainer-email: seto.balian@gmail.com
|
|
12
|
+
Requires-Python: >=3.9,<4.0
|
|
31
13
|
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: Unix
|
|
32
19
|
Classifier: Programming Language :: Python
|
|
33
20
|
Classifier: Programming Language :: Python :: 3
|
|
34
|
-
Classifier:
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
35
25
|
Classifier: Topic :: Scientific/Engineering
|
|
26
|
+
Classifier: Topic :: Software Development
|
|
36
27
|
Classifier: Typing :: Typed
|
|
37
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
38
|
-
Classifier: Operating System :: Unix
|
|
39
|
-
Classifier: Operating System :: MacOS
|
|
40
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
41
|
-
Requires-Python: >=3.7
|
|
42
|
-
Description-Content-Type: text/markdown
|
|
43
28
|
Provides-Extra: numpy
|
|
44
|
-
|
|
29
|
+
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
30
|
+
Requires-Dist: numpy (>=1.26.4,<2.0.0) ; extra == "numpy"
|
|
31
|
+
Requires-Dist: randomgen (>=1.26.1,<2.0.0) ; extra == "numpy"
|
|
32
|
+
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
|
33
|
+
Requires-Dist: xdg (>=6.0.0,<7.0.0)
|
|
34
|
+
Project-URL: Repository, https://github.com/sbalian/quantum-random/
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
45
36
|
|
|
46
37
|
# Quantum random numbers in Python
|
|
47
38
|
|
|
48
|
-
](https://github.com/sbalian/quantum-random/actions/workflows/tests.yml)
|
|
49
41
|
[](https://pypi.org/project/quantum-random/)
|
|
50
42
|

|
|
51
43
|
[](https://pypistats.org/packages/quantum-random)
|
|
@@ -88,12 +80,11 @@ array([[0.37220278, 0.24337193, 0.67534826],
|
|
|
88
80
|
[0.35894084, 0.72219929, 0.55388594]])
|
|
89
81
|
```
|
|
90
82
|
|
|
91
|
-
NumPy is supported using [RandomGen][randomgen].
|
|
92
|
-
no RandomGen wheels available for Python 3.11.
|
|
83
|
+
NumPy is supported using [RandomGen][randomgen].
|
|
93
84
|
|
|
94
85
|
## Installation
|
|
95
86
|
|
|
96
|
-
The minimum supported Python version is 3.
|
|
87
|
+
The minimum supported Python version is 3.9. Install with `pip`:
|
|
97
88
|
|
|
98
89
|
```bash
|
|
99
90
|
pip install -U quantum-random
|
|
@@ -133,10 +124,8 @@ if you need to pre-fetch at the start of your computation.
|
|
|
133
124
|
|
|
134
125
|
## Tests
|
|
135
126
|
|
|
136
|
-
The tests run for Python 3.
|
|
137
|
-
macOS and Ubuntu runner images.
|
|
138
|
-
only with no NumPy support as RandomGen fails to compile. Use [tox][tox] to run
|
|
139
|
-
the tests locally.
|
|
127
|
+
The tests run for Python 3.9 - 3.12 on the latest Windows,
|
|
128
|
+
macOS and Ubuntu runner images.
|
|
140
129
|
|
|
141
130
|
See [here](./analysis/uniform.md) for a visualisation and a Kolmogorov–Smirnov
|
|
142
131
|
test.
|
|
@@ -161,6 +150,6 @@ See [LICENCE](./LICENSE).
|
|
|
161
150
|
[anu]: https://quantumnumbers.anu.edu.au
|
|
162
151
|
[anupricing]: https://quantumnumbers.anu.edu.au/pricing
|
|
163
152
|
[pyrandom]: https://docs.python.org/3/library/random.html
|
|
164
|
-
[tox]: https://tox.wiki/en/latest/
|
|
165
153
|
[numpy]: https://numpy.org
|
|
166
154
|
[randomgen]: https://github.com/bashtage/randomgen
|
|
155
|
+
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Quantum random numbers in Python
|
|
2
2
|
|
|
3
|
-
](https://github.com/sbalian/quantum-random/actions/workflows/tests.yml)
|
|
4
5
|
[](https://pypi.org/project/quantum-random/)
|
|
5
6
|

|
|
6
7
|
[](https://pypistats.org/packages/quantum-random)
|
|
@@ -43,12 +44,11 @@ array([[0.37220278, 0.24337193, 0.67534826],
|
|
|
43
44
|
[0.35894084, 0.72219929, 0.55388594]])
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
NumPy is supported using [RandomGen][randomgen].
|
|
47
|
-
no RandomGen wheels available for Python 3.11.
|
|
47
|
+
NumPy is supported using [RandomGen][randomgen].
|
|
48
48
|
|
|
49
49
|
## Installation
|
|
50
50
|
|
|
51
|
-
The minimum supported Python version is 3.
|
|
51
|
+
The minimum supported Python version is 3.9. Install with `pip`:
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
pip install -U quantum-random
|
|
@@ -88,10 +88,8 @@ if you need to pre-fetch at the start of your computation.
|
|
|
88
88
|
|
|
89
89
|
## Tests
|
|
90
90
|
|
|
91
|
-
The tests run for Python 3.
|
|
92
|
-
macOS and Ubuntu runner images.
|
|
93
|
-
only with no NumPy support as RandomGen fails to compile. Use [tox][tox] to run
|
|
94
|
-
the tests locally.
|
|
91
|
+
The tests run for Python 3.9 - 3.12 on the latest Windows,
|
|
92
|
+
macOS and Ubuntu runner images.
|
|
95
93
|
|
|
96
94
|
See [here](./analysis/uniform.md) for a visualisation and a Kolmogorov–Smirnov
|
|
97
95
|
test.
|
|
@@ -116,6 +114,5 @@ See [LICENCE](./LICENSE).
|
|
|
116
114
|
[anu]: https://quantumnumbers.anu.edu.au
|
|
117
115
|
[anupricing]: https://quantumnumbers.anu.edu.au/pricing
|
|
118
116
|
[pyrandom]: https://docs.python.org/3/library/random.html
|
|
119
|
-
[tox]: https://tox.wiki/en/latest/
|
|
120
117
|
[numpy]: https://numpy.org
|
|
121
118
|
[randomgen]: https://github.com/bashtage/randomgen
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "quantum-random"
|
|
3
|
+
version = "1.4.1"
|
|
4
|
+
description = "Quantum random numbers"
|
|
5
|
+
license = "MIT"
|
|
6
|
+
authors = ["Seto Balian <seto.balian@gmail.com>"]
|
|
7
|
+
maintainers = ["Seto Balian <seto.balian@gmail.com>"]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
homepage = "https://github.com/sbalian/quantum-random/"
|
|
10
|
+
repository = "https://github.com/sbalian/quantum-random/"
|
|
11
|
+
keywords = ["quantum", "random", "statistics"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Intended Audience :: Science/Research",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Programming Language :: Python",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Software Development",
|
|
18
|
+
"Topic :: Scientific/Engineering",
|
|
19
|
+
"Typing :: Typed",
|
|
20
|
+
"Operating System :: Microsoft :: Windows",
|
|
21
|
+
"Operating System :: Unix",
|
|
22
|
+
"Operating System :: MacOS",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
]
|
|
25
|
+
packages = [
|
|
26
|
+
{ include = "qrandom", from = "src" },
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[tool.poetry.dependencies]
|
|
30
|
+
python = "^3.9"
|
|
31
|
+
requests = "^2.31.0"
|
|
32
|
+
xdg = "^6.0.0"
|
|
33
|
+
click = "^8.1.7"
|
|
34
|
+
numpy = {version = "^1.26.4", optional = true}
|
|
35
|
+
randomgen = {version = "^1.26.1", optional = true}
|
|
36
|
+
|
|
37
|
+
[tool.poetry.extras]
|
|
38
|
+
numpy = ["numpy", "randomgen"]
|
|
39
|
+
|
|
40
|
+
[tool.poetry.scripts]
|
|
41
|
+
qrandom-init = "qrandom._cli:main"
|
|
42
|
+
|
|
43
|
+
[tool.poetry.group.dev.dependencies]
|
|
44
|
+
pytest = "^8.0.2"
|
|
45
|
+
pytest-mock = "^3.12.0"
|
|
46
|
+
responses = "^0.25.0"
|
|
47
|
+
mypy = "^1.8.0"
|
|
48
|
+
flake8 = "^7.0.0"
|
|
49
|
+
isort = "^5.13.2"
|
|
50
|
+
black = "^24.2.0"
|
|
51
|
+
|
|
52
|
+
[build-system]
|
|
53
|
+
requires = ["poetry-core"]
|
|
54
|
+
build-backend = "poetry.core.masonry.api"
|
|
55
|
+
|
|
56
|
+
[tool.pytest.ini_options]
|
|
57
|
+
addopts = "--verbose"
|
|
58
|
+
testpaths = "tests"
|
|
59
|
+
|
|
60
|
+
[tool.mypy]
|
|
61
|
+
ignore_missing_imports = true
|
|
62
|
+
|
|
63
|
+
[tool.black]
|
|
64
|
+
line-length = 79
|
|
65
|
+
|
|
66
|
+
[tool.isort]
|
|
67
|
+
profile = "black"
|
|
68
|
+
line_length = 79
|
|
69
|
+
known_first_party = ["qrandom"]
|
|
@@ -13,6 +13,8 @@ large ranges. There is no randbytes() because getrandbits() is not available.
|
|
|
13
13
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
|
+
import sys
|
|
17
|
+
|
|
16
18
|
from ._generator import QuantumRandom
|
|
17
19
|
|
|
18
20
|
__all__ = [
|
|
@@ -44,6 +46,11 @@ __all__ = [
|
|
|
44
46
|
|
|
45
47
|
_inst = QuantumRandom()
|
|
46
48
|
betavariate = _inst.betavariate
|
|
49
|
+
|
|
50
|
+
if (sys.version_info.major, sys.version_info.minor) >= (3, 12):
|
|
51
|
+
binomialvariate = _inst.binomialvariate # type: ignore[attr-defined]
|
|
52
|
+
__all__.append("binomialvariate")
|
|
53
|
+
|
|
47
54
|
choice = _inst.choice
|
|
48
55
|
choices = _inst.choices
|
|
49
56
|
expovariate = _inst.expovariate
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import configparser
|
|
2
2
|
import os
|
|
3
3
|
import pathlib
|
|
4
|
-
from typing import Dict, List, Optional, Union
|
|
4
|
+
from typing import Dict, List, Optional, TypedDict, Union
|
|
5
5
|
|
|
6
6
|
import requests
|
|
7
7
|
import xdg
|
|
8
|
-
from typing_extensions import TypedDict
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
def find_api_key() -> Union[str, None]:
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: Upload Python Package
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [published]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
deploy:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v3
|
|
12
|
-
- name: Set up Python
|
|
13
|
-
uses: actions/setup-python@v4
|
|
14
|
-
with:
|
|
15
|
-
python-version: '3.11'
|
|
16
|
-
- name: Install dependencies
|
|
17
|
-
run: |
|
|
18
|
-
python -m pip install --upgrade pip
|
|
19
|
-
pip install build
|
|
20
|
-
- name: Build package
|
|
21
|
-
run: python -m build
|
|
22
|
-
- name: Publish package
|
|
23
|
-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
|
24
|
-
with:
|
|
25
|
-
user: __token__
|
|
26
|
-
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
name: Testing, type checking and linting
|
|
2
|
-
|
|
3
|
-
on: [push]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
|
|
7
|
-
test:
|
|
8
|
-
runs-on: ${{ matrix.os }}
|
|
9
|
-
strategy:
|
|
10
|
-
matrix:
|
|
11
|
-
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
12
|
-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v3
|
|
15
|
-
- name: Set up Python
|
|
16
|
-
uses: actions/setup-python@v4
|
|
17
|
-
with:
|
|
18
|
-
python-version: ${{ matrix.python-version }}
|
|
19
|
-
- name: Prepare
|
|
20
|
-
run: |
|
|
21
|
-
python -m pip install --upgrade pip
|
|
22
|
-
pip install tox
|
|
23
|
-
- name: Run tests
|
|
24
|
-
run: |
|
|
25
|
-
tox -e py
|
|
26
|
-
|
|
27
|
-
test-numpy:
|
|
28
|
-
runs-on: ${{ matrix.os }}
|
|
29
|
-
strategy:
|
|
30
|
-
matrix:
|
|
31
|
-
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
32
|
-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
|
|
33
|
-
exclude:
|
|
34
|
-
- os: macos-latest
|
|
35
|
-
python-version: '3.11'
|
|
36
|
-
steps:
|
|
37
|
-
- uses: actions/checkout@v3
|
|
38
|
-
- name: Set up Python
|
|
39
|
-
uses: actions/setup-python@v4
|
|
40
|
-
with:
|
|
41
|
-
python-version: ${{ matrix.python-version }}
|
|
42
|
-
- name: Prepare
|
|
43
|
-
run: |
|
|
44
|
-
python -m pip install --upgrade pip
|
|
45
|
-
pip install tox
|
|
46
|
-
- name: Run tests
|
|
47
|
-
run: |
|
|
48
|
-
tox -e numpy
|
|
49
|
-
- name: Check types
|
|
50
|
-
run: |
|
|
51
|
-
mkdir .mypy_cache
|
|
52
|
-
tox -e mypy
|
|
53
|
-
|
|
54
|
-
lint:
|
|
55
|
-
runs-on: ubuntu-latest
|
|
56
|
-
steps:
|
|
57
|
-
- uses: actions/checkout@v3
|
|
58
|
-
- name: Set up Python
|
|
59
|
-
uses: actions/setup-python@v4
|
|
60
|
-
with:
|
|
61
|
-
python-version: '3.11'
|
|
62
|
-
- name: Prepare
|
|
63
|
-
run: |
|
|
64
|
-
python -m pip install --upgrade pip
|
|
65
|
-
pip install tox
|
|
66
|
-
- name: Lint
|
|
67
|
-
run: |
|
|
68
|
-
tox -e flake8,black,isort
|
quantum-random-1.3.2/.gitignore
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Analysis
|
|
2
|
-
|
|
3
|
-
To run the analysis, first install the requirements (includes `quantum-random`):
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
pip install -r requirements.txt
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
Then run the script to generate the plot in `uniform.md`:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
python generate_plot.py
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
The output is written to `random.png`.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import random
|
|
2
|
-
from typing import List, Tuple
|
|
3
|
-
|
|
4
|
-
import matplotlib.pyplot as plt
|
|
5
|
-
from scipy import stats
|
|
6
|
-
|
|
7
|
-
import qrandom
|
|
8
|
-
|
|
9
|
-
DataType = Tuple[Tuple[List[float], str], Tuple[List[float], str]]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def generate_data() -> DataType:
|
|
13
|
-
numbers = [qrandom.random() for _ in range(10000)]
|
|
14
|
-
py_numbers = [random.random() for _ in range(10000)]
|
|
15
|
-
return (numbers, "Quantum random"), (py_numbers, "Python pseudo-random")
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def plot(data: DataType) -> None:
|
|
19
|
-
quantum, python = data
|
|
20
|
-
numbers, quantum_title = quantum
|
|
21
|
-
py_numbers, python_title = python
|
|
22
|
-
|
|
23
|
-
plt.figure(figsize=(8, 3))
|
|
24
|
-
plt.subplot(1, 2, 1)
|
|
25
|
-
plt.hist(numbers, edgecolor="black")
|
|
26
|
-
plt.title(quantum_title)
|
|
27
|
-
plt.subplot(1, 2, 2)
|
|
28
|
-
plt.hist(py_numbers, edgecolor="black")
|
|
29
|
-
plt.title(python_title)
|
|
30
|
-
plt.tight_layout()
|
|
31
|
-
plt.savefig("random.png", dpi=120, bbox_inches="tight")
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def kstest(data: DataType) -> None:
|
|
36
|
-
quantum, python = data
|
|
37
|
-
numbers, quantum_title = quantum
|
|
38
|
-
py_numbers, python_title = python
|
|
39
|
-
|
|
40
|
-
print(quantum_title, stats.kstest(numbers, "uniform"))
|
|
41
|
-
print(python_title, stats.kstest(py_numbers, "uniform"))
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def main() -> None:
|
|
46
|
-
data = generate_data()
|
|
47
|
-
plot(data)
|
|
48
|
-
kstest(data)
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if __name__ == "__main__":
|
|
53
|
-
main()
|
|
Binary file
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Visualise and test if the quantum randoms are uniformly distributed in [0.0, 1)
|
|
2
|
-
|
|
3
|
-
Calling `qrandom.random()` 10,000 times, and comparing it to `random.random()`:
|
|
4
|
-
|
|
5
|
-

|
|
6
|
-
|
|
7
|
-
The [Kolmogorov–Smirnov statistics][kstest] with the reference distribution
|
|
8
|
-
`scipy.uniform` gives the following results.
|
|
9
|
-
|
|
10
|
-
| Trial | Quantum statistic | Quantum p-value | Std. statistic | Std. p-value |
|
|
11
|
-
| ----- | ----------------- | --------------- | ---------------| -------------|
|
|
12
|
-
| 1 | 0.01 | 0.2 | 0.005 | 0.9 |
|
|
13
|
-
| 2 | 0.007 | 0.7 | 0.005 | 1.0 |
|
|
14
|
-
| 3 | 0.006 | 0.9 | 0.008 | 0.6 |
|
|
15
|
-
| 4 | 0.01 | 0.3 | 0.008 | 0.5 |
|
|
16
|
-
|
|
17
|
-
Each trial is a different run of [`scipy.stats.kstest`][scipy-kstest] with
|
|
18
|
-
10,000 numbers. The plot shows the numbers for the last trial.
|
|
19
|
-
|
|
20
|
-
[kstest]: https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test
|
|
21
|
-
[scipy-kstest]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kstest.html
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools", "setuptools-scm"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "quantum-random"
|
|
7
|
-
authors = [{ name = "Seto Balian", email = "seto.balian@gmail.com" }]
|
|
8
|
-
description = "Quantum random numbers"
|
|
9
|
-
keywords = ["quantum", "random", "statistics"]
|
|
10
|
-
readme = "README.md"
|
|
11
|
-
requires-python = ">=3.7"
|
|
12
|
-
license = {file = "LICENSE"}
|
|
13
|
-
dependencies = ["requests", "xdg", "typing-extensions", "click"]
|
|
14
|
-
dynamic = ["version"]
|
|
15
|
-
maintainers = [{ name = "Seto Balian", email = "seto.balian@gmail.com" }]
|
|
16
|
-
classifiers = [
|
|
17
|
-
"Intended Audience :: Science/Research",
|
|
18
|
-
"Intended Audience :: Developers",
|
|
19
|
-
"Programming Language :: Python",
|
|
20
|
-
"Programming Language :: Python :: 3",
|
|
21
|
-
"Topic :: Software Development",
|
|
22
|
-
"Topic :: Scientific/Engineering",
|
|
23
|
-
"Typing :: Typed",
|
|
24
|
-
"Operating System :: Microsoft :: Windows",
|
|
25
|
-
"Operating System :: Unix",
|
|
26
|
-
"Operating System :: MacOS",
|
|
27
|
-
"License :: OSI Approved :: MIT License",
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
[project.urls]
|
|
31
|
-
homepage = "https://github.com/sbalian/quantum-random"
|
|
32
|
-
repository = "https://github.com/sbalian/quantum-random.git"
|
|
33
|
-
|
|
34
|
-
[project.scripts]
|
|
35
|
-
qrandom-init = "qrandom._cli:main"
|
|
36
|
-
|
|
37
|
-
[tool.setuptools_scm]
|
|
38
|
-
version_scheme = "post-release"
|
|
39
|
-
write_to = "src/qrandom/version.py"
|
|
40
|
-
|
|
41
|
-
[project.optional-dependencies]
|
|
42
|
-
numpy = ["numpy", "randomgen"]
|
|
43
|
-
|
|
44
|
-
[tool.black]
|
|
45
|
-
line-length = 79
|
|
46
|
-
|
|
47
|
-
[tool.isort]
|
|
48
|
-
profile = "black"
|
|
49
|
-
line_length = 79
|
|
50
|
-
known_first_party = ["qrandom"]
|
|
51
|
-
|
|
52
|
-
[tool.pytest.ini_options]
|
|
53
|
-
addopts = "--verbose"
|
|
54
|
-
testpaths = "tests"
|
|
55
|
-
norecursedirs = ["tests/data"]
|
|
56
|
-
|
|
57
|
-
[tool.mypy]
|
|
58
|
-
ignore_missing_imports = true
|
|
59
|
-
follow_imports = "silent"
|
|
60
|
-
check_untyped_defs = true
|
|
61
|
-
enable_error_code = ["ignore-without-code"]
|
|
62
|
-
show_error_codes = true
|
|
63
|
-
warn_unused_ignores = false
|
|
64
|
-
exclude = ["__pycache__", ".git", ".tox", "build", ".venv", "dist"]
|
quantum-random-1.3.2/setup.cfg
DELETED