fastrand 3.0.6__cp38-cp38-win_amd64.whl → 3.0.7__cp38-cp38-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,111 +1,146 @@
1
- Metadata-Version: 2.1
2
- Name: fastrand
3
- Version: 3.0.6
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: 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...
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
- print("Generate a number in [0,1).")
31
- fastrand.pcg32_uniform()
32
-
33
- if fastrand.SIXTYFOUR: # support for xorshift128+ is limited to some 64-bit platforms (linux, macos, etc.)
34
- print("generate an integer in [0,1001)")
35
- fastrand.xorshift128plusbounded(1001)
36
- print("generate an integer in [100,1000]")
37
- fastrand.xorshift128plusrandint(100,1000) # requires Python 3.7 or better
38
- print("Generate a random 64-bit integer.")
39
- fastrand.xorshift128plus()
40
- print("Generate a number in [0,1).")
41
- fastrand.xorshift128plus_uniform()
42
- ```
43
-
44
- We also include functions for fast float generation.
45
-
46
- It is nearly an order of magnitude faster than the alternatives:
47
-
48
- ```
49
-
50
- python3 -m timeit -s 'import fastrand' 'fastrand.pcg32bounded(1001)'
51
- 10000000 loops, best of 5: 23.6 nsec per loop
52
-
53
- python3 -m timeit -s 'import fastrand' 'fastrand.pcg32randint(100,1000)'
54
- 10000000 loops, best of 5: 24.6 nsec per loop
55
-
56
- python3 -m timeit -s 'import random' 'random.randint(0,1000)'
57
- 1000000 loops, best of 5: 216 nsec per loop
58
-
59
- # if you have numpy:
60
- python3 -m timeit -s 'import numpy' 'numpy.random.randint(0, 1000)'
61
- 500000 loops, best of 5: 955 nsec per loop
62
-
63
- ```
64
-
65
- The pcg32 generator is a 32-bit generator so it generates values in the interval from `0` to `2**32-1`.
66
- The xorshift128+ generator is a 64-bit generator so that it can generate values in a 64-bit range (up to `2**64-1`).
67
-
68
-
69
- If you have Linux, macOS or Windows, you should be able to do just pip install...
70
-
71
- ```
72
- pip install fastrand
73
- ```
74
-
75
- You may need root access (sudo on macOS and Linux).
76
-
77
- It is sometimes useful to install a specific version, you can do so as follows;
78
-
79
- ```
80
- pip install fastrand==1.2.4
81
- ```
82
-
83
-
84
-
85
- Generally, you can build the library as follows (if you have root):
86
-
87
-
88
- ```bash
89
- python setup.py build
90
- python setup.py install
91
- ```
92
-
93
- or
94
-
95
- ```bash
96
- python setup.py build
97
- python setup.py install --home=$HOME
98
- export PYTHONPATH=$PYTHONPATH:~/lib/python
99
- ```
100
-
101
-
102
- ## Changing the seed and multiple streams
103
-
104
- - 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.
105
- - 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).
106
- - You may also initialize xorshift128+ with `xorshift128plus_seed1` and `xorshift128plus_seed2`.
107
-
108
- ## Reference
109
-
110
- * http://www.pcg-random.org
111
- * 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.cp38-win_amd64.pyd,sha256=FMn0iTqaFJo5QMzywuvxYqGzjRolRkzag3076U3F8hA,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=2M046GvC9RLU1f1TWyM-2sB7cRKLhAC7ucAFK8l8f24,99
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: cp38-cp38-win_amd64
5
5
 
@@ -0,0 +1,2 @@
1
+ fastrand
2
+ wheelhouse
Binary file
@@ -1,6 +0,0 @@
1
- fastrand.cp38-win_amd64.pyd,sha256=aq6vUVRq2Dz-PfC0q7tg-UolHjUZuE7rusLp0rQDlNA,14336
2
- fastrand-3.0.6.dist-info/LICENSE,sha256=4DukHX-rIHAHaf5BGLq1DYAMt0-ZA1OgXS9f_xwig2M,11558
3
- fastrand-3.0.6.dist-info/METADATA,sha256=NDprKtBDwdzFbElqQdM19erv6BE2bfs0SahcrSXwUVY,3751
4
- fastrand-3.0.6.dist-info/WHEEL,sha256=M2GQ3lde8oJhlQPj2wbRvnqE3cuovPJasri5X5aCmck,100
5
- fastrand-3.0.6.dist-info/top_level.txt,sha256=Z3tGZhQlNI6bOnJeYeHyE5sSKqud1hxYNfa7SX5Bm4U,9
6
- fastrand-3.0.6.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- fastrand