fastrand 3.0.5__cp310-cp310-musllinux_1_1_x86_64.whl → 3.0.7__cp310-cp310-musllinux_1_1_x86_64.whl
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.
Potentially problematic release.
This version of fastrand might be problematic. Click here for more details.
- {fastrand-3.0.5.dist-info → fastrand-3.0.7.dist-info}/METADATA +59 -16
- fastrand-3.0.7.dist-info/RECORD +6 -0
- {fastrand-3.0.5.dist-info → fastrand-3.0.7.dist-info}/WHEEL +1 -1
- fastrand-3.0.7.dist-info/top_level.txt +2 -0
- fastrand.cpython-310-x86_64-linux-gnu.so +0 -0
- fastrand-3.0.5.dist-info/RECORD +0 -6
- fastrand-3.0.5.dist-info/top_level.txt +0 -1
- {fastrand-3.0.5.dist-info → fastrand-3.0.7.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,22 +1,41 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: fastrand
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.7
|
|
4
4
|
Summary: Fast random number generation in Python
|
|
5
|
-
Author: Daniel Lemire
|
|
6
|
-
|
|
5
|
+
Author-email: Daniel Lemire <daniel@lemire.me>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/lemire/fastrand
|
|
8
|
+
Project-URL: Repository, https://github.com/lemire/fastrand
|
|
9
|
+
Project-URL: Issues, https://github.com/lemire/fastrand/issues
|
|
10
|
+
Keywords: random,random-number-generator,pcg,xorshift,performance
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: C
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
24
|
+
Requires-Python: >=3.8
|
|
7
25
|
Description-Content-Type: text/markdown
|
|
8
26
|
License-File: LICENSE
|
|
27
|
+
Dynamic: license-file
|
|
9
28
|
|
|
10
29
|
# fastrand
|
|
11
30
|
|
|
12
|
-
Fast random number generation in an interval in Python
|
|
31
|
+
Fast random number generation in an interval in Python: Up to 10x faster than random.randint.
|
|
13
32
|
|
|
14
33
|
Blog post: [Ranged random-number generation is slow in Python](https://lemire.me/blog/2016/03/21/ranged-random-number-generation-is-slow-in-python/)
|
|
15
34
|
|
|
16
35
|
|
|
17
36
|
|
|
18
37
|
|
|
19
|
-
Usage...
|
|
38
|
+
Usage...
|
|
20
39
|
|
|
21
40
|
```python
|
|
22
41
|
import fastrand
|
|
@@ -27,6 +46,8 @@ print("generate an integer in [100,1000]")
|
|
|
27
46
|
fastrand.pcg32randint(100,1000) # requires Python 3.7 or better
|
|
28
47
|
print("Generate a random 32-bit integer.")
|
|
29
48
|
fastrand.pcg32()
|
|
49
|
+
print("Generate a number in [0,1).")
|
|
50
|
+
fastrand.pcg32_uniform()
|
|
30
51
|
|
|
31
52
|
if fastrand.SIXTYFOUR: # support for xorshift128+ is limited to some 64-bit platforms (linux, macos, etc.)
|
|
32
53
|
print("generate an integer in [0,1001)")
|
|
@@ -35,8 +56,12 @@ if fastrand.SIXTYFOUR: # support for xorshift128+ is limited to some 64-bit plat
|
|
|
35
56
|
fastrand.xorshift128plusrandint(100,1000) # requires Python 3.7 or better
|
|
36
57
|
print("Generate a random 64-bit integer.")
|
|
37
58
|
fastrand.xorshift128plus()
|
|
59
|
+
print("Generate a number in [0,1).")
|
|
60
|
+
fastrand.xorshift128plus_uniform()
|
|
38
61
|
```
|
|
39
62
|
|
|
63
|
+
We also include functions for fast float generation.
|
|
64
|
+
|
|
40
65
|
It is nearly an order of magnitude faster than the alternatives:
|
|
41
66
|
|
|
42
67
|
```
|
|
@@ -50,6 +75,7 @@ python3 -m timeit -s 'import fastrand' 'fastrand.pcg32randint(100,1000)'
|
|
|
50
75
|
python3 -m timeit -s 'import random' 'random.randint(0,1000)'
|
|
51
76
|
1000000 loops, best of 5: 216 nsec per loop
|
|
52
77
|
|
|
78
|
+
# if you have numpy:
|
|
53
79
|
python3 -m timeit -s 'import numpy' 'numpy.random.randint(0, 1000)'
|
|
54
80
|
500000 loops, best of 5: 955 nsec per loop
|
|
55
81
|
|
|
@@ -59,36 +85,53 @@ The pcg32 generator is a 32-bit generator so it generates values in the interval
|
|
|
59
85
|
The xorshift128+ generator is a 64-bit generator so that it can generate values in a 64-bit range (up to `2**64-1`).
|
|
60
86
|
|
|
61
87
|
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
62
90
|
If you have Linux, macOS or Windows, you should be able to do just pip install...
|
|
63
91
|
|
|
64
|
-
```
|
|
92
|
+
```bash
|
|
65
93
|
pip install fastrand
|
|
66
94
|
```
|
|
67
95
|
|
|
68
96
|
You may need root access (sudo on macOS and Linux).
|
|
69
97
|
|
|
70
|
-
It is sometimes useful to install a specific version, you can do so as follows
|
|
98
|
+
It is sometimes useful to install a specific version, you can do so as follows:
|
|
71
99
|
|
|
72
|
-
```
|
|
100
|
+
```bash
|
|
73
101
|
pip install fastrand==1.2.4
|
|
74
102
|
```
|
|
75
103
|
|
|
104
|
+
### Using uv (recommended)
|
|
105
|
+
|
|
106
|
+
[uv](https://github.com/astral-sh/uv) is a fast Python package installer and resolver.
|
|
107
|
+
|
|
108
|
+
To add fastrand as a dependency to your project:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
uv add fastrand
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Or to install it directly into your current environment:
|
|
76
115
|
|
|
116
|
+
```bash
|
|
117
|
+
uv pip install fastrand
|
|
118
|
+
```
|
|
77
119
|
|
|
78
|
-
|
|
120
|
+
### Building from source
|
|
79
121
|
|
|
122
|
+
With uv:
|
|
80
123
|
|
|
81
124
|
```bash
|
|
82
|
-
|
|
83
|
-
|
|
125
|
+
uv build
|
|
126
|
+
uv pip install dist/*.whl
|
|
84
127
|
```
|
|
85
128
|
|
|
86
|
-
|
|
129
|
+
Or with standard tools:
|
|
87
130
|
|
|
88
131
|
```bash
|
|
89
|
-
|
|
90
|
-
python
|
|
91
|
-
|
|
132
|
+
pip install build
|
|
133
|
+
python -m build
|
|
134
|
+
pip install dist/*.whl
|
|
92
135
|
```
|
|
93
136
|
|
|
94
137
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
fastrand.cpython-310-x86_64-linux-gnu.so,sha256=rNYTV30cnEolcalEIo5wwQ3ThmNKKJcT5GJMPlNqAfc,49896
|
|
2
|
+
fastrand-3.0.7.dist-info/WHEEL,sha256=meB_1clJyu4y4NqIU0zEPGvVkH6R2AvKyTRAHTGvQP0,112
|
|
3
|
+
fastrand-3.0.7.dist-info/top_level.txt,sha256=hP1UU0jrDjL5G11OfRmlRKfqliLNNwcD51wtEzKsIlU,20
|
|
4
|
+
fastrand-3.0.7.dist-info/METADATA,sha256=N2Oc60NdEvlGsxEO58Kca2ZD--R5M49vSJs-PvsnZzY,4939
|
|
5
|
+
fastrand-3.0.7.dist-info/RECORD,,
|
|
6
|
+
fastrand-3.0.7.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
Binary file
|
fastrand-3.0.5.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
fastrand.cpython-310-x86_64-linux-gnu.so,sha256=Qsq4MT2VVhrwEErya34e6pkxnN6qhrq3lBnGZqnzwZ0,46440
|
|
2
|
-
fastrand-3.0.5.dist-info/WHEEL,sha256=3ltB5TaRdhkt3YYqx2XrZvyTyaxp5dXZb3HWw510bG0,113
|
|
3
|
-
fastrand-3.0.5.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
4
|
-
fastrand-3.0.5.dist-info/METADATA,sha256=owEgXbHVEfvtUClfdx2yyh7YvC0tm5BSb8gTr_2SYII,3597
|
|
5
|
-
fastrand-3.0.5.dist-info/top_level.txt,sha256=Z3tGZhQlNI6bOnJeYeHyE5sSKqud1hxYNfa7SX5Bm4U,9
|
|
6
|
-
fastrand-3.0.5.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fastrand
|
|
File without changes
|