pcg64-cross 0.1.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.
- pcg64_cross-0.1.1/.gitignore +78 -0
- pcg64_cross-0.1.1/Cargo.lock +345 -0
- pcg64_cross-0.1.1/Cargo.toml +17 -0
- pcg64_cross-0.1.1/LICENSE +14 -0
- pcg64_cross-0.1.1/Makefile +46 -0
- pcg64_cross-0.1.1/PKG-INFO +10 -0
- pcg64_cross-0.1.1/README.md +60 -0
- pcg64_cross-0.1.1/pyproject.toml +24 -0
- pcg64_cross-0.1.1/python/pcg64_cross/__init__.py +7 -0
- pcg64_cross-0.1.1/python/pcg64_cross/__version__.py +1 -0
- pcg64_cross-0.1.1/python/pcg64_cross/outer_stream.py +528 -0
- pcg64_cross-0.1.1/python/pcg64_cross/pcg64_api.py +232 -0
- pcg64_cross-0.1.1/python/pcg64_cross/pcg64_state.py +191 -0
- pcg64_cross-0.1.1/src/lib.rs +910 -0
- pcg64_cross-0.1.1/tests/test_api.py +93 -0
- pcg64_cross-0.1.1/tests/test_hybrid.py +182 -0
- pcg64_cross-0.1.1/tests/test_lockstep.py +186 -0
- pcg64_cross-0.1.1/tests/test_outer.py +228 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/target
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
.venv/
|
|
14
|
+
env/
|
|
15
|
+
bin/
|
|
16
|
+
build/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
include/
|
|
26
|
+
man/
|
|
27
|
+
venv/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
pip-selfcheck.json
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
|
|
45
|
+
# Translations
|
|
46
|
+
*.mo
|
|
47
|
+
|
|
48
|
+
# Mr Developer
|
|
49
|
+
.mr.developer.cfg
|
|
50
|
+
.project
|
|
51
|
+
.pydevproject
|
|
52
|
+
|
|
53
|
+
# Rope
|
|
54
|
+
.ropeproject
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
.DS_Store
|
|
61
|
+
|
|
62
|
+
# Sphinx documentation
|
|
63
|
+
docs/_build/
|
|
64
|
+
|
|
65
|
+
# PyCharm
|
|
66
|
+
.idea/
|
|
67
|
+
|
|
68
|
+
# VSCode
|
|
69
|
+
.vscode/
|
|
70
|
+
|
|
71
|
+
# Pyenv
|
|
72
|
+
.python-version
|
|
73
|
+
|
|
74
|
+
# Other stuff
|
|
75
|
+
*.swp
|
|
76
|
+
**/target
|
|
77
|
+
**/.DS_Store
|
|
78
|
+
Cargo.lock
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cfg-if"
|
|
13
|
+
version = "1.0.4"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "getrandom"
|
|
19
|
+
version = "0.3.4"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
|
22
|
+
dependencies = [
|
|
23
|
+
"cfg-if",
|
|
24
|
+
"libc",
|
|
25
|
+
"r-efi",
|
|
26
|
+
"wasip2",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[[package]]
|
|
30
|
+
name = "heck"
|
|
31
|
+
version = "0.5.0"
|
|
32
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
34
|
+
|
|
35
|
+
[[package]]
|
|
36
|
+
name = "libc"
|
|
37
|
+
version = "0.2.189"
|
|
38
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
+
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|
40
|
+
|
|
41
|
+
[[package]]
|
|
42
|
+
name = "matrixmultiply"
|
|
43
|
+
version = "0.3.11"
|
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
+
checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"
|
|
46
|
+
dependencies = [
|
|
47
|
+
"autocfg",
|
|
48
|
+
"rawpointer",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[[package]]
|
|
52
|
+
name = "ndarray"
|
|
53
|
+
version = "0.17.2"
|
|
54
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
+
checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d"
|
|
56
|
+
dependencies = [
|
|
57
|
+
"matrixmultiply",
|
|
58
|
+
"num-complex",
|
|
59
|
+
"num-integer",
|
|
60
|
+
"num-traits",
|
|
61
|
+
"portable-atomic",
|
|
62
|
+
"portable-atomic-util",
|
|
63
|
+
"rawpointer",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[[package]]
|
|
67
|
+
name = "num-complex"
|
|
68
|
+
version = "0.4.6"
|
|
69
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
70
|
+
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
|
71
|
+
dependencies = [
|
|
72
|
+
"num-traits",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[[package]]
|
|
76
|
+
name = "num-integer"
|
|
77
|
+
version = "0.1.47"
|
|
78
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
79
|
+
checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
|
|
80
|
+
dependencies = [
|
|
81
|
+
"num-traits",
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
[[package]]
|
|
85
|
+
name = "num-traits"
|
|
86
|
+
version = "0.2.19"
|
|
87
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
88
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
89
|
+
dependencies = [
|
|
90
|
+
"autocfg",
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[[package]]
|
|
94
|
+
name = "numpy"
|
|
95
|
+
version = "0.29.0"
|
|
96
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
97
|
+
checksum = "6a5b15d63a5ff39e378daed0e1340d3a5964703ea9712eb09a0dc66fade996f4"
|
|
98
|
+
dependencies = [
|
|
99
|
+
"libc",
|
|
100
|
+
"ndarray",
|
|
101
|
+
"num-complex",
|
|
102
|
+
"num-integer",
|
|
103
|
+
"num-traits",
|
|
104
|
+
"pyo3",
|
|
105
|
+
"pyo3-build-config",
|
|
106
|
+
"rustc-hash",
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
[[package]]
|
|
110
|
+
name = "once_cell"
|
|
111
|
+
version = "1.21.4"
|
|
112
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
113
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
114
|
+
|
|
115
|
+
[[package]]
|
|
116
|
+
name = "pcg64-cross"
|
|
117
|
+
version = "0.1.0"
|
|
118
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
119
|
+
checksum = "6a741b54b09df88a70834c06b95577d67dd7d8898e7cc4b67c3869761634f60e"
|
|
120
|
+
dependencies = [
|
|
121
|
+
"rand",
|
|
122
|
+
"rand_pcg",
|
|
123
|
+
]
|
|
124
|
+
|
|
125
|
+
[[package]]
|
|
126
|
+
name = "pcg64_cross_py"
|
|
127
|
+
version = "0.1.1"
|
|
128
|
+
dependencies = [
|
|
129
|
+
"numpy",
|
|
130
|
+
"pcg64-cross",
|
|
131
|
+
"pyo3",
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
[[package]]
|
|
135
|
+
name = "portable-atomic"
|
|
136
|
+
version = "1.15.0"
|
|
137
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
138
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
139
|
+
|
|
140
|
+
[[package]]
|
|
141
|
+
name = "portable-atomic-util"
|
|
142
|
+
version = "0.2.7"
|
|
143
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
144
|
+
checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618"
|
|
145
|
+
dependencies = [
|
|
146
|
+
"portable-atomic",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
[[package]]
|
|
150
|
+
name = "ppv-lite86"
|
|
151
|
+
version = "0.2.21"
|
|
152
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
153
|
+
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
|
154
|
+
dependencies = [
|
|
155
|
+
"zerocopy",
|
|
156
|
+
]
|
|
157
|
+
|
|
158
|
+
[[package]]
|
|
159
|
+
name = "proc-macro2"
|
|
160
|
+
version = "1.0.107"
|
|
161
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
162
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
163
|
+
dependencies = [
|
|
164
|
+
"unicode-ident",
|
|
165
|
+
]
|
|
166
|
+
|
|
167
|
+
[[package]]
|
|
168
|
+
name = "pyo3"
|
|
169
|
+
version = "0.29.2"
|
|
170
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
171
|
+
checksum = "4688ddedf473e32662b9b067670129a8afb8c18e351482c70d62ba4a88171e8b"
|
|
172
|
+
dependencies = [
|
|
173
|
+
"libc",
|
|
174
|
+
"once_cell",
|
|
175
|
+
"portable-atomic",
|
|
176
|
+
"pyo3-build-config",
|
|
177
|
+
"pyo3-ffi",
|
|
178
|
+
"pyo3-macros",
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
[[package]]
|
|
182
|
+
name = "pyo3-build-config"
|
|
183
|
+
version = "0.29.2"
|
|
184
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
185
|
+
checksum = "f41027e41b4bd03f6e60f9f417fe24a6341a6bb744edd62b6f709f2a52ea30e9"
|
|
186
|
+
dependencies = [
|
|
187
|
+
"target-lexicon",
|
|
188
|
+
]
|
|
189
|
+
|
|
190
|
+
[[package]]
|
|
191
|
+
name = "pyo3-ffi"
|
|
192
|
+
version = "0.29.2"
|
|
193
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
194
|
+
checksum = "e591a95526fead067432c3b3a33fc74770b87b1e04e73671090d9c2055a2b327"
|
|
195
|
+
dependencies = [
|
|
196
|
+
"libc",
|
|
197
|
+
"pyo3-build-config",
|
|
198
|
+
]
|
|
199
|
+
|
|
200
|
+
[[package]]
|
|
201
|
+
name = "pyo3-macros"
|
|
202
|
+
version = "0.29.2"
|
|
203
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
204
|
+
checksum = "73225868fc1cd84eef2c3c230ddb91273bf1de46aeb8a4248da76d32a0924a1c"
|
|
205
|
+
dependencies = [
|
|
206
|
+
"proc-macro2",
|
|
207
|
+
"pyo3-macros-backend",
|
|
208
|
+
"quote",
|
|
209
|
+
"syn",
|
|
210
|
+
]
|
|
211
|
+
|
|
212
|
+
[[package]]
|
|
213
|
+
name = "pyo3-macros-backend"
|
|
214
|
+
version = "0.29.2"
|
|
215
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
216
|
+
checksum = "571575aa3749fa6216757dd47d2a3e7ef360f329a40f0666a9fbd14889024952"
|
|
217
|
+
dependencies = [
|
|
218
|
+
"heck",
|
|
219
|
+
"proc-macro2",
|
|
220
|
+
"quote",
|
|
221
|
+
"syn",
|
|
222
|
+
]
|
|
223
|
+
|
|
224
|
+
[[package]]
|
|
225
|
+
name = "quote"
|
|
226
|
+
version = "1.0.47"
|
|
227
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
228
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
229
|
+
dependencies = [
|
|
230
|
+
"proc-macro2",
|
|
231
|
+
]
|
|
232
|
+
|
|
233
|
+
[[package]]
|
|
234
|
+
name = "r-efi"
|
|
235
|
+
version = "5.3.0"
|
|
236
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
237
|
+
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
|
238
|
+
|
|
239
|
+
[[package]]
|
|
240
|
+
name = "rand"
|
|
241
|
+
version = "0.9.5"
|
|
242
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
243
|
+
checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"
|
|
244
|
+
dependencies = [
|
|
245
|
+
"rand_chacha",
|
|
246
|
+
"rand_core",
|
|
247
|
+
]
|
|
248
|
+
|
|
249
|
+
[[package]]
|
|
250
|
+
name = "rand_chacha"
|
|
251
|
+
version = "0.9.0"
|
|
252
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
253
|
+
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
|
254
|
+
dependencies = [
|
|
255
|
+
"ppv-lite86",
|
|
256
|
+
"rand_core",
|
|
257
|
+
]
|
|
258
|
+
|
|
259
|
+
[[package]]
|
|
260
|
+
name = "rand_core"
|
|
261
|
+
version = "0.9.5"
|
|
262
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
263
|
+
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
|
|
264
|
+
dependencies = [
|
|
265
|
+
"getrandom",
|
|
266
|
+
]
|
|
267
|
+
|
|
268
|
+
[[package]]
|
|
269
|
+
name = "rand_pcg"
|
|
270
|
+
version = "0.9.0"
|
|
271
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
272
|
+
checksum = "b48ac3f7ffaab7fac4d2376632268aa5f89abdb55f7ebf8f4d11fffccb2320f7"
|
|
273
|
+
dependencies = [
|
|
274
|
+
"rand_core",
|
|
275
|
+
]
|
|
276
|
+
|
|
277
|
+
[[package]]
|
|
278
|
+
name = "rawpointer"
|
|
279
|
+
version = "0.2.1"
|
|
280
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
281
|
+
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
|
282
|
+
|
|
283
|
+
[[package]]
|
|
284
|
+
name = "rustc-hash"
|
|
285
|
+
version = "2.1.3"
|
|
286
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
287
|
+
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
|
288
|
+
|
|
289
|
+
[[package]]
|
|
290
|
+
name = "syn"
|
|
291
|
+
version = "2.0.119"
|
|
292
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
293
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
294
|
+
dependencies = [
|
|
295
|
+
"proc-macro2",
|
|
296
|
+
"quote",
|
|
297
|
+
"unicode-ident",
|
|
298
|
+
]
|
|
299
|
+
|
|
300
|
+
[[package]]
|
|
301
|
+
name = "target-lexicon"
|
|
302
|
+
version = "0.13.5"
|
|
303
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
304
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
305
|
+
|
|
306
|
+
[[package]]
|
|
307
|
+
name = "unicode-ident"
|
|
308
|
+
version = "1.0.24"
|
|
309
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
310
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
311
|
+
|
|
312
|
+
[[package]]
|
|
313
|
+
name = "wasip2"
|
|
314
|
+
version = "1.0.4+wasi-0.2.12"
|
|
315
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
316
|
+
checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487"
|
|
317
|
+
dependencies = [
|
|
318
|
+
"wit-bindgen",
|
|
319
|
+
]
|
|
320
|
+
|
|
321
|
+
[[package]]
|
|
322
|
+
name = "wit-bindgen"
|
|
323
|
+
version = "0.57.1"
|
|
324
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
325
|
+
checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
|
|
326
|
+
|
|
327
|
+
[[package]]
|
|
328
|
+
name = "zerocopy"
|
|
329
|
+
version = "0.8.56"
|
|
330
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
331
|
+
checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb"
|
|
332
|
+
dependencies = [
|
|
333
|
+
"zerocopy-derive",
|
|
334
|
+
]
|
|
335
|
+
|
|
336
|
+
[[package]]
|
|
337
|
+
name = "zerocopy-derive"
|
|
338
|
+
version = "0.8.56"
|
|
339
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
340
|
+
checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1"
|
|
341
|
+
dependencies = [
|
|
342
|
+
"proc-macro2",
|
|
343
|
+
"quote",
|
|
344
|
+
"syn",
|
|
345
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "pcg64_cross_py"
|
|
3
|
+
version = "0.1.1"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
8
|
+
[lib]
|
|
9
|
+
name = "_pcg64_cross"
|
|
10
|
+
crate-type = ["cdylib"]
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
pyo3 = { version = "0.29.0", features = ["extension-module", "abi3-py39"] }
|
|
14
|
+
numpy = "0.29.0"
|
|
15
|
+
# This will only work in a place like my "Repos" directory
|
|
16
|
+
pcg64-cross = "0.1.0"
|
|
17
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Vera Delfavero
|
|
4
|
+
All rights reserved
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
11
|
+
|
|
12
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.PHONY: clean all version whl install pytest tests \
|
|
2
|
+
test_api test_hybrid test_lockstep test_outer
|
|
3
|
+
|
|
4
|
+
all: tests
|
|
5
|
+
|
|
6
|
+
######## Setup ########
|
|
7
|
+
VERSION = 0.1.1
|
|
8
|
+
version: clean
|
|
9
|
+
echo "__version__ = '${VERSION}'" > python/pcg64_cross/__version__.py
|
|
10
|
+
sed --in-place "s/^version = .*/version = \"${VERSION}\"/" Cargo.toml
|
|
11
|
+
|
|
12
|
+
######## Installation ########
|
|
13
|
+
whl: clean version
|
|
14
|
+
maturin build --release --sdist
|
|
15
|
+
|
|
16
|
+
install: whl
|
|
17
|
+
pip install . --group test
|
|
18
|
+
|
|
19
|
+
######## Tests ########
|
|
20
|
+
test_api: install
|
|
21
|
+
python3 tests/test_api.py
|
|
22
|
+
|
|
23
|
+
test_hybrid: install
|
|
24
|
+
python3 tests/test_hybrid.py
|
|
25
|
+
|
|
26
|
+
test_lockstep: install
|
|
27
|
+
python3 tests/test_lockstep.py
|
|
28
|
+
|
|
29
|
+
test_outer: install
|
|
30
|
+
python3 tests/test_outer.py
|
|
31
|
+
|
|
32
|
+
pytest: install
|
|
33
|
+
pytest
|
|
34
|
+
|
|
35
|
+
# Keeping lockstep for performance
|
|
36
|
+
tests: pytest test_lockstep
|
|
37
|
+
|
|
38
|
+
######## Publish ########
|
|
39
|
+
|
|
40
|
+
pypi: whl install tests
|
|
41
|
+
twine upload target/wheels/*
|
|
42
|
+
|
|
43
|
+
clean:
|
|
44
|
+
rm -rf target/wheels/*
|
|
45
|
+
rm -rf python/pcg64_cross/*.so
|
|
46
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pcg64-cross
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Requires-Dist: numpy>=1.26.4
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Summary: PyO3 extension for PCG64 synchronization with NumPy/Rust
|
|
10
|
+
Requires-Python: >=3.9
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Python bindings for Rust pcg64-cross crate
|
|
2
|
+
|
|
3
|
+
I created a Rust pseudo-random number generator crate (https://gitlab.com/xevra/pcg64-cross) for providing lockstep random number generation in Rust / Python, using the PCG64 implementation already existing in NumPy and `rand_pcg`.
|
|
4
|
+
|
|
5
|
+
There's also some utilities for serializing Rust/NumPy random number generator states.
|
|
6
|
+
|
|
7
|
+
This was my first maturin package, so feedback is welcome.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Installation of the source distribution may require having the rust compiler Cargo installed.
|
|
12
|
+
|
|
13
|
+
#### From Pypi
|
|
14
|
+
```bash
|
|
15
|
+
pip install pcg64-cross
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
#### From source
|
|
19
|
+
```bash
|
|
20
|
+
git clone https://gitlab.com/xevra/pcg64-cross-py
|
|
21
|
+
cd pcg64-cross-py
|
|
22
|
+
pip install .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
# Start from generator API
|
|
29
|
+
api = PCG64GeneratorAPI(42)
|
|
30
|
+
# Get the state object
|
|
31
|
+
state = api.state
|
|
32
|
+
# Make a Rust generator
|
|
33
|
+
prng = state.rust_generator()
|
|
34
|
+
# Make some random numbers
|
|
35
|
+
np_uni = api.uniform(size=int(1e6))
|
|
36
|
+
rs_uni = api.uniform(size=int(1e6))
|
|
37
|
+
assert np.all(np_uni == rs_uni)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
- Pyo3 `HybridStream` object which calls the Rust prng stream directly
|
|
43
|
+
- Python `OuterStream` object which contains pure python wrapper for `HybridStream`
|
|
44
|
+
- `PCG64GeneratorState` object which fully specifies a random number generator state and can produce NumPy/Rust streams from a given state.
|
|
45
|
+
- `PCG64GeneratorAPI` object which provides an interface for a NumPy random number generator with some useful metadata and serialization features.
|
|
46
|
+
|
|
47
|
+
## Contributions
|
|
48
|
+
|
|
49
|
+
I am open to suggestions and pull requests.
|
|
50
|
+
|
|
51
|
+
## LLM policy
|
|
52
|
+
|
|
53
|
+
LLMs may be used for educational purposes, to provide examples, to explain concepts, and to check work / look for bugs. I have used them this way.
|
|
54
|
+
|
|
55
|
+
Asking an LLM to check your work is not a substitute for writing tests.
|
|
56
|
+
|
|
57
|
+
Incorporating elements of LLM responses is allowed, provided you understand each line and can't think of a better way to write the line yourself.
|
|
58
|
+
|
|
59
|
+
LLMs may not make commits. Furthermore, any pull request with commit messages authored by an LLM will be rejected.
|
|
60
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["maturin>=1.14,<2.0"]
|
|
3
|
+
build-backend = "maturin"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pcg64-cross"
|
|
7
|
+
description = "PyO3 extension for PCG64 synchronization with NumPy/Rust"
|
|
8
|
+
requires-python = ">=3.9"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Programming Language :: Rust",
|
|
11
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
12
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
13
|
+
]
|
|
14
|
+
dynamic = ["version"]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"numpy>=1.26.4",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[dependency-groups]
|
|
20
|
+
test = ["pytest", "xev-data>=0.3.0"]
|
|
21
|
+
|
|
22
|
+
[tool.maturin]
|
|
23
|
+
python-source = "python"
|
|
24
|
+
module-name = "pcg64_cross._pcg64_cross"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
######## Imports ########
|
|
2
|
+
#### Local ####
|
|
3
|
+
from pcg64_cross._pcg64_cross import HybridStream
|
|
4
|
+
from pcg64_cross.outer_stream import OuterStream
|
|
5
|
+
from pcg64_cross.pcg64_state import PCG64GeneratorState
|
|
6
|
+
from pcg64_cross.pcg64_api import PCG64GeneratorAPI, seed_parser
|
|
7
|
+
from pcg64_cross.__version__ import __version__
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.1.1'
|