@@ -18,12 +18,12 @@ y = rnd.random_sample(100)
18
18
z = rnd.randn(10 ,10 )
19
19
```
20
20
21
- * Default random generator is identical to NumPy's RandomState (i.e., same
22
- seed, same random numbers).
23
- * Support for random number generators that support independent streams and
24
- jumping ahead so that substreams can be generated
25
- * Faster random number generations , especially for Normals using the Ziggurat
26
- method
21
+ * Default random generator is identical to NumPy's RandomState (i.e.,
22
+ same seed, same random numbers).
23
+ * Support for random number generators that support independent streams
24
+ and jumping ahead so that substreams can be generated
25
+ * Faster random number generation , especially for Normals using the
26
+ Ziggurat method
27
27
28
28
``` python
29
29
import randomstate as rnd
@@ -49,34 +49,36 @@ version of the MT19937 generator that is especially fast at generating doubles
49
49
## Differences from ` numpy.random.RandomState `
50
50
51
51
### New Features
52
- * ` standard_normal ` , ` normal ` , ` randn ` and ` multivariate_normal ` all support
53
- an additional ` method ` keyword argument which can be ` bm ` or ` zig ` where
54
- ` bm ` corresponds to the current method and ` zig ` uses the much faster
55
- (100%+) ziggurat method.
52
+ * ` standard_normal ` , ` normal ` , ` randn ` and ` multivariate_normal ` all
53
+ support an additional ` method ` keyword argument which can be ` bm ` or
54
+ ` zig ` where ` bm ` corresponds to the current method using the Box-Muller
55
+ transformation and ` zig ` uses the much faster (100%+) ziggurat method.
56
56
57
57
### New Functions
58
58
59
- * ` random_entropy ` - Read from the system entropy provider, which is commonly
60
- used in cryptographic applications
59
+ * ` random_entropy ` - Read from the system entropy provider, which is
60
+ commonly used in cryptographic applications
61
61
* ` random_uintegers ` - unsigned integers ` [0, 2**64-1] `
62
- * ` random_raw ` - Direct access to the values produced by the underlying PRNG.
63
- The range of the values returned depends on the specifics of the PRNG
64
- implementation.
62
+ * ` random_raw ` - Direct access to the values produced by the underlying
63
+ PRNG. The range of the values returned depends on the specifics of the
64
+ PRNG implementation.
65
65
* ` jump ` - Jumps RNGs that support it. ` jump ` moves the state a great
66
66
distance. _ Only available if supported by the RNG._
67
67
* ` advance ` - Advanced the core RNG 'as-if' a number of draws were made,
68
- without actually drawing the numbers. _ Only available if supported by the RNG._
68
+ without actually drawing the numbers. _ Only available if supported by
69
+ the RNG._
69
70
70
71
## Status
71
72
72
73
* Complete drop-in replacement for ` numpy.random.RandomState ` . The ` mt19937 `
73
74
generator is identical to ` numpy.random.RandomState ` , and will produce an
74
75
identical sequence of random numbers for a given seed.
75
76
* Builds and passes all tests on:
76
- * Linux 32/64 bit, Python 2.6, 2. 7, 3.3 , 3.4, 3.5
77
+ * Linux 32/64 bit, Python 2.7, 3.4 , 3.5 (should work on 2.6 and 3.3)
77
78
* PC-BSD (FreeBSD) 64-bit, Python 2.7
78
79
* OSX 64-bit, Python 2.7
79
- * Windows 32/64 bit (only tested on Python 2.7 and 3.5, but should work on 3.3/3.4)
80
+ * Windows 32/64 bit (only tested on Python 2.7 and 3.5, but should
81
+ work on 3.3/3.4)
80
82
81
83
## Version
82
84
The version matched the latest version of NumPy where
@@ -88,18 +90,19 @@ An occasionally updated build of the documentation is available on
88
90
[ my github pages] ( http://bashtage.github.io/ng-numpy-randomstate/ ) .
89
91
90
92
## Plans
91
- This module is essentially complete. There are a few rough edges that need to be smoothed.
93
+ This module is essentially complete. There are a few rough edges that
94
+ need to be smoothed.
92
95
93
96
* Stream support for MLFG
94
- * Creation of additional streams from a RandomState where supported (i.e.
95
- a ` next_stream() ` method)
97
+ * Creation of additional streams from a RandomState where supported
98
+ (i.e. a ` next_stream() ` method)
96
99
97
100
## Requirements
98
101
Building requires:
99
102
100
103
* Numpy (1.9, 1.10, 1.11)
101
104
* Cython (0.22, 0.23, 0.24)
102
- * Python (2.6, 2.7, 3.3 , 3.4, 3.5)
105
+ * Python (2.7 , 3.4, 3.5)
103
106
104
107
** Note:** it might work with other versions but only tested with these
105
108
versions.
@@ -119,18 +122,19 @@ python setup.py install
119
122
```
120
123
121
124
### SSE2
122
- ` dSFTM ` makes use of SSE2 by default. If you have a very old computer or are
123
- building on non-x86, you can install using:
125
+ ` dSFTM ` makes use of SSE2 by default. If you have a very old computer
126
+ or are building on non-x86, you can install using:
124
127
125
128
``` bash
126
129
python setup.py install --no-sse2
127
130
```
128
131
129
132
### Windows
130
- Either use a binary installer or if building from scratch using Python 3.5 and
131
- the free Visual Studio 2015 Community Edition. It can also be build using
132
- Microsoft Visual C++ Compiler for Python 2.7 and Python 2.7, although some
133
- modifications are needed to ` distutils ` to find the compiler.
133
+ Either use a binary installer, or if building from scratch, use
134
+ Python 3.5 with Visual Studio 2015 Community Edition. It can also be
135
+ build using Microsoft Visual C++ Compiler for Python 2.7 and Python 2.7,
136
+ although some modifications may be needed to ` distutils ` to find the
137
+ compiler.
134
138
135
139
## Using
136
140
@@ -167,27 +171,39 @@ Standard NCSA, plus sub licenses for components.
167
171
Performance is promising, and even the mt19937 seems to be faster than NumPy's mt19937.
168
172
169
173
```
170
- Speed-up relative to NumPy (Box-Muller )
174
+ Speed-up relative to NumPy (Uniform Doubles )
171
175
************************************************************
172
- randomstate.prng-dsfmt-standard_normal 30.2 %
173
- randomstate.prng-mlfg_1279_861-standard_normal 24.7 %
174
- randomstate.prng-mrg32k3a-standard_normal -17.8 %
175
- randomstate.prng-mt19937-standard_normal 11.2 %
176
- randomstate.prng-pcg32-standard_normal 22.0 %
177
- randomstate.prng-pcg64-standard_normal 21.8 %
178
- randomstate.prng-xoroshiro128plus-standard_normal 26.5 %
179
- randomstate.prng-xorshift1024-standard_normal 20.2 %
180
- randomstate.prng-xorshift128-standard_normal 23.5 %
181
-
182
- Speed-up relative to NumPy (Ziggurat )
176
+ randomstate.prng-dsfmt-random_sample 313.5 %
177
+ randomstate.prng-mlfg_1279_861-random_sample 459.4 %
178
+ randomstate.prng-mrg32k3a-random_sample -57.6 %
179
+ randomstate.prng-mt19937-random_sample 72.5 %
180
+ randomstate.prng-pcg32-random_sample 232.8 %
181
+ randomstate.prng-pcg64-random_sample 330.6 %
182
+ randomstate.prng-xoroshiro128plus-random_sample 609.9 %
183
+ randomstate.prng-xorshift1024-random_sample 348.8 %
184
+ randomstate.prng-xorshift128-random_sample 489.7 %
185
+
186
+ Speed-up relative to NumPy (Normals using Box-Muller )
183
187
************************************************************
184
- randomstate.prng-dsfmt-standard_normal 494.2%
185
- randomstate.prng-mlfg_1279_861-standard_normal 464.2%
186
- randomstate.prng-mrg32k3a-standard_normal 103.8%
187
- randomstate.prng-mt19937-standard_normal 362.6%
188
- randomstate.prng-pcg32-standard_normal 539.6%
189
- randomstate.prng-pcg64-standard_normal 407.7%
190
- randomstate.prng-xoroshiro128plus-standard_normal 722.8%
191
- randomstate.prng-xorshift1024-standard_normal 506.1%
192
- randomstate.prng-xorshift128-standard_normal 686.3%
188
+ randomstate.prng-dsfmt-standard_normal 26.8%
189
+ randomstate.prng-mlfg_1279_861-standard_normal 30.9%
190
+ randomstate.prng-mrg32k3a-standard_normal -14.8%
191
+ randomstate.prng-mt19937-standard_normal 17.7%
192
+ randomstate.prng-pcg32-standard_normal 24.5%
193
+ randomstate.prng-pcg64-standard_normal 26.2%
194
+ randomstate.prng-xoroshiro128plus-standard_normal 31.4%
195
+ randomstate.prng-xorshift1024-standard_normal 27.4%
196
+ randomstate.prng-xorshift128-standard_normal 30.3%
197
+
198
+ Speed-up relative to NumPy (Normals using Ziggurat)
199
+ ************************************************************
200
+ randomstate.prng-dsfmt-standard_normal 491.7%
201
+ randomstate.prng-mlfg_1279_861-standard_normal 439.6%
202
+ randomstate.prng-mrg32k3a-standard_normal 101.2%
203
+ randomstate.prng-mt19937-standard_normal 354.4%
204
+ randomstate.prng-pcg32-standard_normal 531.0%
205
+ randomstate.prng-pcg64-standard_normal 517.9%
206
+ randomstate.prng-xoroshiro128plus-standard_normal 674.0%
207
+ randomstate.prng-xorshift1024-standard_normal 486.7%
208
+ randomstate.prng-xorshift128-standard_normal 617.0%
193
209
```
0 commit comments