@@ -18,12 +18,12 @@ y = rnd.random_sample(100)
1818z = rnd.randn(10 ,10 )
1919```
2020
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
2727
2828``` python
2929import randomstate as rnd
@@ -49,34 +49,36 @@ version of the MT19937 generator that is especially fast at generating doubles
4949## Differences from ` numpy.random.RandomState `
5050
5151### 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.
5656
5757### New Functions
5858
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
6161* ` 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.
6565* ` jump ` - Jumps RNGs that support it. ` jump ` moves the state a great
6666distance. _ Only available if supported by the RNG._
6767* ` 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._
6970
7071## Status
7172
7273* Complete drop-in replacement for ` numpy.random.RandomState ` . The ` mt19937 `
7374generator is identical to ` numpy.random.RandomState ` , and will produce an
7475identical sequence of random numbers for a given seed.
7576* 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)
7778 * PC-BSD (FreeBSD) 64-bit, Python 2.7
7879 * 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)
8082
8183## Version
8284The version matched the latest version of NumPy where
@@ -88,18 +90,19 @@ An occasionally updated build of the documentation is available on
8890[ my github pages] ( http://bashtage.github.io/ng-numpy-randomstate/ ) .
8991
9092## 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.
9295
9396 * 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)
9699
97100## Requirements
98101Building requires:
99102
100103 * Numpy (1.9, 1.10, 1.11)
101104 * 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)
103106
104107** Note:** it might work with other versions but only tested with these
105108versions.
@@ -119,18 +122,19 @@ python setup.py install
119122```
120123
121124### 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:
124127
125128``` bash
126129python setup.py install --no-sse2
127130```
128131
129132### 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.
134138
135139## Using
136140
@@ -167,27 +171,39 @@ Standard NCSA, plus sub licenses for components.
167171Performance is promising, and even the mt19937 seems to be faster than NumPy's mt19937.
168172
169173```
170- Speed-up relative to NumPy (Box-Muller )
174+ Speed-up relative to NumPy (Uniform Doubles )
171175************************************************************
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 )
183187************************************************************
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%
193209```
0 commit comments