fastrand 3.0.5__cp311-cp311-win_amd64.whl → 3.0.7__cp311-cp311-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,147 @@
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.4
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
+ Dynamic: license-file
28
+
29
+ # fastrand
30
+
31
+ Fast random number generation in an interval in Python: Up to 10x faster than random.randint.
32
+
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/)
34
+
35
+
36
+
37
+
38
+ Usage...
39
+
40
+ ```python
41
+ import fastrand
42
+
43
+ print("generate an integer in [0,1001)")
44
+ fastrand.pcg32bounded(1001)
45
+ print("generate an integer in [100,1000]")
46
+ fastrand.pcg32randint(100,1000) # requires Python 3.7 or better
47
+ print("Generate a random 32-bit integer.")
48
+ fastrand.pcg32()
49
+ print("Generate a number in [0,1).")
50
+ fastrand.pcg32_uniform()
51
+
52
+ if fastrand.SIXTYFOUR: # support for xorshift128+ is limited to some 64-bit platforms (linux, macos, etc.)
53
+ print("generate an integer in [0,1001)")
54
+ fastrand.xorshift128plusbounded(1001)
55
+ print("generate an integer in [100,1000]")
56
+ fastrand.xorshift128plusrandint(100,1000) # requires Python 3.7 or better
57
+ print("Generate a random 64-bit integer.")
58
+ fastrand.xorshift128plus()
59
+ print("Generate a number in [0,1).")
60
+ fastrand.xorshift128plus_uniform()
61
+ ```
62
+
63
+ We also include functions for fast float generation.
64
+
65
+ It is nearly an order of magnitude faster than the alternatives:
66
+
67
+ ```
68
+
69
+ python3 -m timeit -s 'import fastrand' 'fastrand.pcg32bounded(1001)'
70
+ 10000000 loops, best of 5: 23.6 nsec per loop
71
+
72
+ python3 -m timeit -s 'import fastrand' 'fastrand.pcg32randint(100,1000)'
73
+ 10000000 loops, best of 5: 24.6 nsec per loop
74
+
75
+ python3 -m timeit -s 'import random' 'random.randint(0,1000)'
76
+ 1000000 loops, best of 5: 216 nsec per loop
77
+
78
+ # if you have numpy:
79
+ python3 -m timeit -s 'import numpy' 'numpy.random.randint(0, 1000)'
80
+ 500000 loops, best of 5: 955 nsec per loop
81
+
82
+ ```
83
+
84
+ The pcg32 generator is a 32-bit generator so it generates values in the interval from `0` to `2**32-1`.
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`).
86
+
87
+
88
+ ## Installation
89
+
90
+ If you have Linux, macOS or Windows, you should be able to do just pip install...
91
+
92
+ ```bash
93
+ pip install fastrand
94
+ ```
95
+
96
+ You may need root access (sudo on macOS and Linux).
97
+
98
+ It is sometimes useful to install a specific version, you can do so as follows:
99
+
100
+ ```bash
101
+ pip install fastrand==1.2.4
102
+ ```
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:
115
+
116
+ ```bash
117
+ uv pip install fastrand
118
+ ```
119
+
120
+ ### Building from source
121
+
122
+ With uv:
123
+
124
+ ```bash
125
+ uv build
126
+ uv pip install dist/*.whl
127
+ ```
128
+
129
+ Or with standard tools:
130
+
131
+ ```bash
132
+ pip install build
133
+ python -m build
134
+ pip install dist/*.whl
135
+ ```
136
+
137
+
138
+ ## Changing the seed and multiple streams
139
+
140
+ - 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.
141
+ - 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).
142
+ - You may also initialize xorshift128+ with `xorshift128plus_seed1` and `xorshift128plus_seed2`.
143
+
144
+ ## Reference
145
+
146
+ * http://www.pcg-random.org
147
+ * 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.cp311-win_amd64.pyd,sha256=_PqqSGqlhYfPsLTUtuUBS-QsdcPV3AKVJpyDNtN1rV8,14336
2
+ fastrand-3.0.7.dist-info/licenses/LICENSE,sha256=4DukHX-rIHAHaf5BGLq1DYAMt0-ZA1OgXS9f_xwig2M,11558
3
+ fastrand-3.0.7.dist-info/METADATA,sha256=4-LxrJ58KLf7FZICRmcpAkGaC-8QA2A_DmufZr14Z_M,5086
4
+ fastrand-3.0.7.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101
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 (80.9.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-win_amd64
5
5
 
@@ -0,0 +1,2 @@
1
+ fastrand
2
+ wheelhouse
Binary file
@@ -1,6 +0,0 @@
1
- fastrand.cp311-win_amd64.pyd,sha256=m6hJdS-rJmRL-BZcWTK-_eR8Dw-IOQsyrnZbtyefMjY,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=TxwUeV-3HEbjjXVQ7qnUZIKQ4IinhZYV_rmkwq84M_Y,102
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