1
1
.. _new-or-different :
2
2
3
+ .. currentmodule :: numpy.random.randomgen
4
+
3
5
What's New or Different
4
6
-----------------------
5
7
6
8
.. warning ::
7
9
8
10
The Box-Muller method used to produce NumPy's normals is no longer available
9
- in :class: `~randomgen.generator.RandomGenerator `. It is not possible to
10
- reproduce the random values using :class: `~randomgen.generator.RandomGenerator `
11
- for the normal distribution or any other distribution that relies on the
12
- normal such as the gamma or student's t. If you require backward compatibility, a
13
- legacy generator, :class: `~randomgen.legacy.LegacyGenerator `, has been created
14
- which can fully reproduce the sequence produced by NumPy.
11
+ in `~.RandomGenerator `. It is not possible to
12
+ reproduce the exact random values using ``RandomGenerator `` for the normal
13
+ distribution or any other distribution that relies on the normal such as the
14
+ `numpy.random.gamma ` or `numpy.random.standard_t `. If you require backward
15
+ compatibility, a legacy generator, `~.legacy.
16
+ LegacyGenerator `, has been created which can fully reproduce the exact byte
17
+ sequence produced by legacy code.
15
18
16
19
17
- * :func: ` ~randomgen .entropy.random_entropy ` provides access to the system
20
+ * ` ~ .entropy.random_entropy ` provides access to the system
18
21
source of randomness that is used in cryptographic applications (e.g.,
19
22
``/dev/urandom `` on Unix).
20
23
* Simulate from the complex normal distribution
21
- (:meth: ` ~randomgen.generator .RandomGenerator.complex_normal `)
24
+ (` ~ .RandomGenerator.complex_normal `)
22
25
* The normal, exponential and gamma generators use 256-step Ziggurat
23
26
methods which are 2-10 times faster than NumPy's default implementation in
24
- :meth: ` ~randomgen.generator .RandomGenerator.standard_normal `,
25
- :meth: ` ~randomgen.generator .RandomGenerator.standard_exponential ` or
26
- :meth: ` ~randomgen.generator .RandomGenerator.standard_gamma `.
27
+ ` ~ .RandomGenerator.standard_normal `,
28
+ ` ~ .RandomGenerator.standard_exponential ` or
29
+ ` ~ .RandomGenerator.standard_gamma `.
27
30
* The Box-Muller used to produce NumPy's normals is no longer available.
28
31
* All basic random generators functions to produce doubles, uint64s and
29
- uint32s via CTypes (:meth: ` ~randomgen .xoroshiro128.Xoroshiro128.ctypes `)
30
- and CFFI (:meth: ` ~randomgen .xoroshiro128.Xoroshiro128.cffi `). This allows
31
- these basic RNGs to be used in numba.
32
+ uint32s via CTypes (` ~ .xoroshiro128.Xoroshiro128.
33
+ ctypes `) and CFFI (` ~ .xoroshiro128.Xoroshiro128.cffi `).
34
+ This allows these basic RNGs to be used in numba.
32
35
* The basic random number generators can be used in downstream projects via
33
36
Cython.
34
37
35
38
36
39
.. ipython :: python
37
40
38
- from numpy.random.randomgen import Xoroshiro128
41
+ from numpy.random.randomgen import Xoroshiro128
39
42
import numpy.random
40
43
rg = Xoroshiro128().generator
41
44
% timeit rg.standard_normal(100000 )
@@ -55,12 +58,12 @@ What's New or Different
55
58
to produce either single or double prevision uniform random variables for
56
59
select distributions
57
60
58
- * Uniforms (:meth: ` ~randomgen.generator .RandomGenerator.random_sample ` and
59
- :meth: ` ~randomgen.generator .RandomGenerator.rand `)
60
- * Normals (:meth: ` ~randomgen.generator .RandomGenerator.standard_normal ` and
61
- :meth: ` ~randomgen.generator .RandomGenerator.randn `)
62
- * Standard Gammas (:meth: ` ~randomgen.generator .RandomGenerator.standard_gamma `)
63
- * Standard Exponentials (:meth: ` ~randomgen.generator .RandomGenerator.standard_exponential `)
61
+ * Uniforms (` ~ .RandomGenerator.random_sample ` and
62
+ ` ~ .RandomGenerator.rand `)
63
+ * Normals (` ~ .RandomGenerator.standard_normal ` and
64
+ ` ~ .RandomGenerator.randn `)
65
+ * Standard Gammas (` ~ .RandomGenerator.standard_gamma `)
66
+ * Standard Exponentials (` ~ .RandomGenerator.standard_exponential `)
64
67
65
68
.. ipython :: python
66
69
@@ -72,10 +75,10 @@ What's New or Different
72
75
* Optional ``out `` argument that allows existing arrays to be filled for
73
76
select distributions
74
77
75
- * Uniforms (:meth: ` ~randomgen.generator .RandomGenerator.random_sample `)
76
- * Normals (:meth: ` ~randomgen.generator .RandomGenerator.standard_normal `)
77
- * Standard Gammas (:meth: ` ~randomgen.generator .RandomGenerator.standard_gamma `)
78
- * Standard Exponentials (:meth: ` ~randomgen.generator .RandomGenerator.standard_exponential `)
78
+ * Uniforms (` ~ .RandomGenerator.random_sample `)
79
+ * Normals (` ~ .RandomGenerator.standard_normal `)
80
+ * Standard Gammas (` ~ .RandomGenerator.standard_gamma `)
81
+ * Standard Exponentials (` ~ .RandomGenerator.standard_exponential `)
79
82
80
83
This allows multithreading to fill large arrays in chunks using suitable
81
84
PRNGs in parallel.
@@ -90,7 +93,7 @@ What's New or Different
90
93
91
94
* Support for Lemire’s method of generating uniform integers on an
92
95
arbitrary interval by setting ``use_masked=True `` in
93
- (:meth: ` ~randomgen.generator .RandomGenerator.randint `).
96
+ (` ~ .RandomGenerator.randint `).
94
97
95
98
.. ipython :: python
96
99
0 commit comments