fastrand 3.0.5__pp38-pypy38_pp73-win_amd64.whl → 3.0.7__pp38-pypy38_pp73-win_amd64.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.

@@ -1,104 +1,146 @@
1
- Metadata-Version: 2.1
2
- Name: fastrand
3
- Version: 3.0.5
4
- Summary: Fast random number generation in Python
5
- Author: Daniel Lemire
6
- Author-email: daniel@lemire.me
7
- Description-Content-Type: text/markdown
8
- License-File: LICENSE
9
-
10
- # fastrand
11
-
12
- Fast random number generation in an interval in Python using PCG: Up to 10x faster than random.randint.
13
-
14
- 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
-
16
-
17
-
18
-
19
- Usage... (don't forget to type the above lines in your shell!)
20
-
21
- ```python
22
- import fastrand
23
-
24
- print("generate an integer in [0,1001)")
25
- fastrand.pcg32bounded(1001)
26
- print("generate an integer in [100,1000]")
27
- fastrand.pcg32randint(100,1000) # requires Python 3.7 or better
28
- print("Generate a random 32-bit integer.")
29
- fastrand.pcg32()
30
-
31
- if fastrand.SIXTYFOUR: # support for xorshift128+ is limited to some 64-bit platforms (linux, macos, etc.)
32
- print("generate an integer in [0,1001)")
33
- fastrand.xorshift128plusbounded(1001)
34
- print("generate an integer in [100,1000]")
35
- fastrand.xorshift128plusrandint(100,1000) # requires Python 3.7 or better
36
- print("Generate a random 64-bit integer.")
37
- fastrand.xorshift128plus()
38
- ```
39
-
40
- It is nearly an order of magnitude faster than the alternatives:
41
-
42
- ```
43
-
44
- python3 -m timeit -s 'import fastrand' 'fastrand.pcg32bounded(1001)'
45
- 10000000 loops, best of 5: 23.6 nsec per loop
46
-
47
- python3 -m timeit -s 'import fastrand' 'fastrand.pcg32randint(100,1000)'
48
- 10000000 loops, best of 5: 24.6 nsec per loop
49
-
50
- python3 -m timeit -s 'import random' 'random.randint(0,1000)'
51
- 1000000 loops, best of 5: 216 nsec per loop
52
-
53
- python3 -m timeit -s 'import numpy' 'numpy.random.randint(0, 1000)'
54
- 500000 loops, best of 5: 955 nsec per loop
55
-
56
- ```
57
-
58
- The pcg32 generator is a 32-bit generator so it generates values in the interval from `0` to `2**32-1`.
59
- 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
-
61
-
62
- If you have Linux, macOS or Windows, you should be able to do just pip install...
63
-
64
- ```
65
- pip install fastrand
66
- ```
67
-
68
- You may need root access (sudo on macOS and Linux).
69
-
70
- It is sometimes useful to install a specific version, you can do so as follows;
71
-
72
- ```
73
- pip install fastrand==1.2.4
74
- ```
75
-
76
-
77
-
78
- Generally, you can build the library as follows (if you have root):
79
-
80
-
81
- ```bash
82
- python setup.py build
83
- python setup.py install
84
- ```
85
-
86
- or
87
-
88
- ```bash
89
- python setup.py build
90
- python setup.py install --home=$HOME
91
- export PYTHONPATH=$PYTHONPATH:~/lib/python
92
- ```
93
-
94
-
95
- ## Changing the seed and multiple streams
96
-
97
- - You can change the seed with a function like `pcg32_seed`. The seed determines the random values you get. Be mindful that naive seeds (e.g., `int(time.time())`) can deliver poor initial randomness. A few calls to `pcg32()` may help to boost the improve the randomness. Or else you may try a better seed.
98
- - If you need to produce multiple streams of random numbers, merely changing the seed is not enough. You are better off using different increments by calling the `pcg32inc`. The increments should all be distinct. Note that the least significant bit of the increment is always set to 1 no matter which value you pass: so make sure your increments are distinct 31-bit values (ignoring the least significant bit).
99
- - You may also initialize xorshift128+ with `xorshift128plus_seed1` and `xorshift128plus_seed2`.
100
-
101
- ## Reference
102
-
103
- * http://www.pcg-random.org
104
- * Daniel Lemire, [Fast Random Integer Generation in an Interval](https://arxiv.org/abs/1805.10941), ACM Transactions on Modeling and Computer Simulation, Volume 29 Issue 1, February 2019
1
+ Metadata-Version: 2.1
2
+ Name: fastrand
3
+ Version: 3.0.7
4
+ Summary: Fast random number generation in Python
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
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+
28
+ # fastrand
29
+
30
+ Fast random number generation in an interval in Python: Up to 10x faster than random.randint.
31
+
32
+ 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/)
33
+
34
+
35
+
36
+
37
+ Usage...
38
+
39
+ ```python
40
+ import fastrand
41
+
42
+ print("generate an integer in [0,1001)")
43
+ fastrand.pcg32bounded(1001)
44
+ print("generate an integer in [100,1000]")
45
+ fastrand.pcg32randint(100,1000) # requires Python 3.7 or better
46
+ print("Generate a random 32-bit integer.")
47
+ fastrand.pcg32()
48
+ print("Generate a number in [0,1).")
49
+ fastrand.pcg32_uniform()
50
+
51
+ if fastrand.SIXTYFOUR: # support for xorshift128+ is limited to some 64-bit platforms (linux, macos, etc.)
52
+ print("generate an integer in [0,1001)")
53
+ fastrand.xorshift128plusbounded(1001)
54
+ print("generate an integer in [100,1000]")
55
+ fastrand.xorshift128plusrandint(100,1000) # requires Python 3.7 or better
56
+ print("Generate a random 64-bit integer.")
57
+ fastrand.xorshift128plus()
58
+ print("Generate a number in [0,1).")
59
+ fastrand.xorshift128plus_uniform()
60
+ ```
61
+
62
+ We also include functions for fast float generation.
63
+
64
+ It is nearly an order of magnitude faster than the alternatives:
65
+
66
+ ```
67
+
68
+ python3 -m timeit -s 'import fastrand' 'fastrand.pcg32bounded(1001)'
69
+ 10000000 loops, best of 5: 23.6 nsec per loop
70
+
71
+ python3 -m timeit -s 'import fastrand' 'fastrand.pcg32randint(100,1000)'
72
+ 10000000 loops, best of 5: 24.6 nsec per loop
73
+
74
+ python3 -m timeit -s 'import random' 'random.randint(0,1000)'
75
+ 1000000 loops, best of 5: 216 nsec per loop
76
+
77
+ # if you have numpy:
78
+ python3 -m timeit -s 'import numpy' 'numpy.random.randint(0, 1000)'
79
+ 500000 loops, best of 5: 955 nsec per loop
80
+
81
+ ```
82
+
83
+ The pcg32 generator is a 32-bit generator so it generates values in the interval from `0` to `2**32-1`.
84
+ The xorshift128+ generator is a 64-bit generator so that it can generate values in a 64-bit range (up to `2**64-1`).
85
+
86
+
87
+ ## Installation
88
+
89
+ If you have Linux, macOS or Windows, you should be able to do just pip install...
90
+
91
+ ```bash
92
+ pip install fastrand
93
+ ```
94
+
95
+ You may need root access (sudo on macOS and Linux).
96
+
97
+ It is sometimes useful to install a specific version, you can do so as follows:
98
+
99
+ ```bash
100
+ pip install fastrand==1.2.4
101
+ ```
102
+
103
+ ### Using uv (recommended)
104
+
105
+ [uv](https://github.com/astral-sh/uv) is a fast Python package installer and resolver.
106
+
107
+ To add fastrand as a dependency to your project:
108
+
109
+ ```bash
110
+ uv add fastrand
111
+ ```
112
+
113
+ Or to install it directly into your current environment:
114
+
115
+ ```bash
116
+ uv pip install fastrand
117
+ ```
118
+
119
+ ### Building from source
120
+
121
+ With uv:
122
+
123
+ ```bash
124
+ uv build
125
+ uv pip install dist/*.whl
126
+ ```
127
+
128
+ Or with standard tools:
129
+
130
+ ```bash
131
+ pip install build
132
+ python -m build
133
+ pip install dist/*.whl
134
+ ```
135
+
136
+
137
+ ## Changing the seed and multiple streams
138
+
139
+ - You can change the seed with a function like `pcg32_seed`. The seed determines the random values you get. Be mindful that naive seeds (e.g., `int(time.time())`) can deliver poor initial randomness. A few calls to `pcg32()` may help to boost the improve the randomness. Or else you may try a better seed.
140
+ - If you need to produce multiple streams of random numbers, merely changing the seed is not enough. You are better off using different increments by calling the `pcg32inc`. The increments should all be distinct. Note that the least significant bit of the increment is always set to 1 no matter which value you pass: so make sure your increments are distinct 31-bit values (ignoring the least significant bit).
141
+ - You may also initialize xorshift128+ with `xorshift128plus_seed1` and `xorshift128plus_seed2`.
142
+
143
+ ## Reference
144
+
145
+ * http://www.pcg-random.org
146
+ * Daniel Lemire, [Fast Random Integer Generation in an Interval](https://arxiv.org/abs/1805.10941), ACM Transactions on Modeling and Computer Simulation, Volume 29 Issue 1, February 2019
@@ -0,0 +1,6 @@
1
+ fastrand.pypy38-pp73-win_amd64.pyd,sha256=XNy9xpAZNRn3rjUbZ6hfMvAKCxeJA-QGkRvCktYrij8,14336
2
+ fastrand-3.0.7.dist-info/LICENSE,sha256=4DukHX-rIHAHaf5BGLq1DYAMt0-ZA1OgXS9f_xwig2M,11558
3
+ fastrand-3.0.7.dist-info/METADATA,sha256=41C6Jvw5Y-a040WUVlOMuOUPj6zZjhtgInfP8BYq_J0,5063
4
+ fastrand-3.0.7.dist-info/WHEEL,sha256=Ud1iIBeo_0He1fs5taa1TvkeU9XIUeToqiq5pfQ8w5w,106
5
+ fastrand-3.0.7.dist-info/top_level.txt,sha256=hP1UU0jrDjL5G11OfRmlRKfqliLNNwcD51wtEzKsIlU,20
6
+ fastrand-3.0.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.37.1)
2
+ Generator: setuptools (75.3.2)
3
3
  Root-Is-Purelib: false
4
4
  Tag: pp38-pypy38_pp73-win_amd64
5
5
 
@@ -0,0 +1,2 @@
1
+ fastrand
2
+ wheelhouse
Binary file
@@ -1,6 +0,0 @@
1
- fastrand.pypy38-pp73-win_amd64.pyd,sha256=dWaUXgn7bKvJEX9FVAYXk7JxwtJU8uYiTsupSBtSfMo,14336
2
- fastrand-3.0.5.dist-info/LICENSE,sha256=4DukHX-rIHAHaf5BGLq1DYAMt0-ZA1OgXS9f_xwig2M,11558
3
- fastrand-3.0.5.dist-info/METADATA,sha256=owEgXbHVEfvtUClfdx2yyh7YvC0tm5BSb8gTr_2SYII,3597
4
- fastrand-3.0.5.dist-info/WHEEL,sha256=06TODGy9zsn9QCb4Oo1wjtnM2jOjgiTR78nw1cWltRU,107
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