diff options
author | Bharat123rox <bharatraghunthan9767@gmail.com> | 2021-04-18 12:10:07 +0530 |
---|---|---|
committer | Bharat123rox <bharatraghunthan9767@gmail.com> | 2021-04-18 12:10:07 +0530 |
commit | 2232a473f8713f532c8164c8cf616f7bd05f54a7 (patch) | |
tree | ad45f3009d850f122f3d04388611730d650abfb5 | |
parent | cffb693566360e33c76ef6d9981ced15dbebacff (diff) | |
download | numpy-2232a473f8713f532c8164c8cf616f7bd05f54a7.tar.gz |
DOC: Improve random.choice() documentation
-rw-r--r-- | numpy/random/_generator.pyx | 7 | ||||
-rw-r--r-- | numpy/random/mtrand.pyx | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index a68303501..cd0b24872 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -614,11 +614,12 @@ cdef class Generator: len(size)``. Default is None, in which case a single value is returned. replace : bool, optional - Whether the sample is with or without replacement + Whether the sample is with or without replacement. Default is True, + meaning that a value of ``a`` can be selected multiple times. p : 1-D array_like, optional The probabilities associated with each entry in a. - If not given the sample assumes a uniform distribution over all - entries in a. + If not given, the sample assumes a uniform distribution over all + entries in ``a``. axis : int, optional The axis along which the selection is performed. The default, 0, selects by row. diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx index e166634be..863879a04 100644 --- a/numpy/random/mtrand.pyx +++ b/numpy/random/mtrand.pyx @@ -820,17 +820,18 @@ cdef class RandomState: ---------- a : 1-D array-like or int If an ndarray, a random sample is generated from its elements. - If an int, the random sample is generated as if a were np.arange(a) + If an int, the random sample is generated as if it were ``np.arange(a)`` size : int or tuple of ints, optional Output shape. If the given shape is, e.g., ``(m, n, k)``, then ``m * n * k`` samples are drawn. Default is None, in which case a single value is returned. replace : boolean, optional - Whether the sample is with or without replacement + Whether the sample is with or without replacement. Default is True, + meaning that a value of ``a`` can be selected multiple times. p : 1-D array-like, optional The probabilities associated with each entry in a. - If not given the sample assumes a uniform distribution over all - entries in a. + If not given, the sample assumes a uniform distribution over all + entries in ``a``. Returns ------- |