8000 Merge pull request #27 from bashtage/remove-.generator-doc · bashtage/numpy@ef20a4e · GitHub
[go: up one dir, main page]

Skip to content

Commit ef20a4e

Browse files
authored
Merge pull request #27 from bashtage/remove-.generator-doc
DOC: Remove references to .generator
2 parents c302f49 + c8f403e commit ef20a4e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

doc/source/reference/random/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ the random values are generated by `~xoroshiro128.Xoroshiro128`. The
5252
5353
5454
Seeds can be passed to any of the BitGenerators. Here `mt19937.MT19937` is used
55-
and the ``Generator`` is accessed via the attribute `mt19937.MT19937.
56-
generator`.
55+
and is the wrapped with a `~.Generator`.
56+
5757

5858
.. code-block:: python
5959
60-
from numpy.random import MT19937
61-
rg = MT19937(12345).generator
60+
from numpy.random import Generator, MT19937
61+
rg = Generator(MT19937(12345))
6262
rg.standard_normal()
6363
6464
@@ -78,7 +78,7 @@ bit generator-provided stream and transforms them into more useful
7878
distributions, e.g., simulated normal random values. This structure allows
7979
alternative bit generators to be used with little code duplication.
8080

81-
The ``Generator`` is the user-facing object
81+
The `~.Generator` is the user-facing object
8282
that is nearly identical to :class:`~.RandomState`. The canonical
8383
method to initialize a generator passes a `~mt19937.MT19937` bit generator, the
8484
underlying bit generator in Python -- as the sole argument. Note that the bit

doc/source/reference/random/multithreading.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ are reproducible in the sense that the same seed will produce the same outputs.
1616

1717
.. code-block:: ipython
1818
19-
from numpy.random import Xorshift1024
19+
from numpy.random import Generator, Xorshift1024
2020
import multiprocessing
2121
import concurrent.futures
2222
import numpy as np
@@ -88,7 +88,7 @@ The single threaded call directly uses the PRNG.
8888
.. code-block:: ipython
8989
9090
In [5]: values = np.empty(10000000)
91-
...: rg = Xorshift1024().generator
91+
...: rg = Generator(Xorshift1024())
9292
...: %timeit rg.standard_normal(out=values)
9393
9494
99.6 ms ± 222 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
@@ -99,7 +99,7 @@ that does not use an existing array due to array creation overhead.
9999

100100
.. code-block:: ipython
101101
102-
In [6]: rg = Xorshift1024().generator
102+
In [6]: rg = Generator(Xorshift1024())
103103
...: %timeit rg.standard_normal(10000000)
104104
105105
125 ms ± 309 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

0 commit comments

Comments
 (0)
0