From 1ceb96bd45b9b24518de3eb314e217c942eb403c Mon Sep 17 00:00:00 2001 From: Bram Date: Mon, 27 Jun 2022 12:48:41 +0200 Subject: [PATCH 1/5] DOC: Mention uniform in the np.random.Generator.random function. Added a See also section to mention np.random.Generator.uniform. --- numpy/random/_generator.pyx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index 8092c8e7acfd..6c8e408138a1 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -242,7 +242,7 @@ cdef class Generator: Return random floats in the half-open interval [0.0, 1.0). Results are from the "continuous uniform" distribution over the - stated interval. To sample :math:`Unif[a, b), b > a` multiply + stated interval. To sample :math:`Unif[a, b), b > a` use `uniform` or multiply the output of `random` by `(b-a)` and add `a`:: (b - a) * random() + a @@ -267,6 +267,10 @@ cdef class Generator: Array of random floats of shape `size` (unless ``size=None``, in which case a single float is returned). + See Also + -------- + uniform : Drawn samples from the parameterized uniform distribution. + Examples -------- >>> rng = np.random.default_rng() From c7b0bb26143834c59689c92d86af843c5e67eca0 Mon Sep 17 00:00:00 2001 From: Bram Date: Wed, 29 Jun 2022 10:28:18 +0200 Subject: [PATCH 2/5] Corrected reference to uniform() --- numpy/random/_generator.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index 6c8e408138a1..c4e2a934e9c6 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -242,7 +242,7 @@ cdef class Generator: Return random floats in the half-open interval [0.0, 1.0). Results are from the "continuous uniform" distribution over the - stated interval. To sample :math:`Unif[a, b), b > a` use `uniform` or multiply + stated interval. To sample :math:`Unif[a, b), b > a` use `~.Generator.uniform` or multiply the output of `random` by `(b-a)` and add `a`:: (b - a) * random() + a @@ -269,7 +269,7 @@ cdef class Generator: See Also -------- - uniform : Drawn samples from the parameterized uniform distribution. + ~.Generator.uniform : Drawn samples from the parameterized uniform distribution. Examples -------- From e472fec0ecfec531a12a50d59614c2597f67877a Mon Sep 17 00:00:00 2001 From: Bram Date: Wed, 29 Jun 2022 10:55:09 +0200 Subject: [PATCH 3/5] Forgot backticks --- numpy/random/_generator.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index c4e2a934e9c6..caa041d55ba4 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -269,7 +269,7 @@ cdef class Generator: See Also -------- - ~.Generator.uniform : Drawn samples from the parameterized uniform distribution. + `~.Generator.uniform` : Drawn samples from the parameterized uniform distribution. Examples -------- From 5376be2084eb93962d33df921775747e338ce521 Mon Sep 17 00:00:00 2001 From: Bram Date: Fri, 8 Jul 2022 12:18:04 +0200 Subject: [PATCH 4/5] Links suddenly working --- numpy/random/_generator.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index caa041d55ba4..f65fc5d8b8cf 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -242,7 +242,7 @@ cdef class Generator: Return random floats in the half-open interval [0.0, 1.0). Results are from the "continuous uniform" distribution over the - stated interval. To sample :math:`Unif[a, b), b > a` use `~.Generator.uniform` or multiply + stated interval. To sample :math:`Unif[a, b), b > a` use `uniform` or multiply the output of `random` by `(b-a)` and add `a`:: (b - a) * random() + a @@ -269,7 +269,7 @@ cdef class Generator: See Also -------- - `~.Generator.uniform` : Drawn samples from the parameterized uniform distribution. + uniform : Draw samples from the parameterized uniform distribution. Examples -------- From 5111b1ee832f861a44a7afb1cf19e10fffe5ce4a Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 10 Jul 2022 09:32:35 -0600 Subject: [PATCH 5/5] MAINT: Small fixups --- numpy/random/_generator.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index f65fc5d8b8cf..c33c55580953 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -242,10 +242,10 @@ cdef class Generator: Return random floats in the half-open interval [0.0, 1.0). Results are from the "continuous uniform" distribution over the - stated interval. To sample :math:`Unif[a, b), b > a` use `uniform` or multiply - the output of `random` by `(b-a)` and add `a`:: + stated interval. To sample :math:`Unif[a, b), b > a` use `uniform` + or multiply the output of `random` by ``(b - a)`` and add ``a``:: - (b - a) * random() + a + (b - a) * random() + a Parameters ----------