Skip to content

Commit 67e20da

Browse files
DOC: align with template docstrings for some random funcs (#368)
* DOC: aligne with template docstrings for some random funcs
1 parent d9d0416 commit 67e20da

File tree

1 file changed

+31
-53
lines changed

1 file changed

+31
-53
lines changed

dpnp/random/dpnp_iface_random.py

Lines changed: 31 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -185,29 +185,20 @@ def bytes(length):
185185
186186
Return random bytes.
187187
188-
Parameters
189-
----------
190-
length : int
191-
Number of random bytes.
188+
For full documentation refer to :obj:`numpy.random.bytes`.
192189
193-
Returns
194-
-------
195-
out : str
196-
String of length `length`.
197-
198-
Examples
199-
--------
200-
>>> dpnp.random.bytes(10)
201-
' eh\\x85\\x022SZ\\xbf\\xa4' #random
190+
Notes
191+
-----
192+
The function uses `numpy.random.bytes` on the backend and will be
193+
executed on fallback backend.
202194
203195
"""
204196

205197
return call_origin(numpy.random.bytes, length)
206198

207199

208200
def chisquare(df, size=None):
209-
"""
210-
chisquare(df, size=None)
201+
"""Chi-square distribution
211202
212203
Draw samples from a chi-square distribution.
213204
@@ -1309,21 +1300,25 @@ def seed(seed=None):
13091300
"""
13101301
Reseed a legacy philox4x32x10 random number generator engine.
13111302
1312-
Parameters
1313-
----------
1314-
seed : {None, int}, optional
1303+
Limitations
1304+
-----------
1305+
Parameter ``seed`` is supported as a scalar.
1306+
Otherwise, the function will use :obj:`numpy.random.seed` on the backend
1307+
and will be executed on fallback backend.
13151308
13161309
"""
13171310

13181311
if not use_origin_backend(seed):
1312+
# TODO:
1313+
# array_like of ints for `seed`
1314+
if seed is None:
1315+
seed = 1
13191316
if not isinstance(seed, int):
13201317
pass
13211318
elif seed < 0:
13221319
pass
13231320
else:
1324-
if seed is None:
1325-
seed = 1
1326-
dpnp_srand(seed)
1321+
return dpnp_srand(seed)
13271322

13281323
return call_origin(numpy.random.seed, seed)
13291324

@@ -1335,16 +1330,9 @@ def standard_cauchy(size=None):
13351330
13361331
Also known as the Lorentz distribution.
13371332
1338-
Parameters
1339-
----------
1340-
size : int, optional
1341-
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
1342-
``m * n * k`` samples are drawn.
1343-
1344-
Returns
1345-
-------
1346-
samples : dparray
1347-
The drawn samples.
1333+
Limitations
1334+
-----------
1335+
Output array data type is :obj:`dpnp.float64`.
13481336
13491337
Examples
13501338
--------
@@ -1371,17 +1359,9 @@ def standard_exponential(size=None):
13711359
`standard_exponential` is identical to the exponential distribution
13721360
with a scale parameter of 1.
13731361
1374-
Parameters
1375-
----------
1376-
size : int or tuple of ints, optional
1377-
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
1378-
``m * n * k`` samples are drawn. Default is None, in which case a
1379-
single value is returned.
1380-
1381-
Returns
1382-
-------
1383-
out : dparray
1384-
Drawn samples.
1362+
Limitations
1363+
-----------
1364+
Output array data type is :obj:`dpnp.float64`.
13851365
13861366
Examples
13871367
--------
@@ -1436,18 +1416,16 @@ def standard_normal(size=None):
14361416
14371417
Draw samples from a standard Normal distribution (mean=0, stdev=1).
14381418
1439-
Parameters
1440-
----------
1441-
size : int, optional
1442-
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
1443-
``m * n * k`` samples are drawn. Default is None, in which case a
1444-
single value is returned.
1419+
For full documentation refer to :obj:`numpy.random.standard_normal`.
14451420
1446-
Returns
1447-
-------
1448-
out : float or ndarray
1449-
A floating-point array of shape ``size`` of drawn samples, or a
1450-
single sample if ``size`` was not specified.
1421+
Limitations
1422+
-----------
1423+
Output array data type is :obj:`dpnp.float64`.
1424+
1425+
Examples
1426+
--------
1427+
Draw samples from the distribution:
1428+
>>> s = dpnp.random.standard_normal(1000)
14511429
14521430
"""
14531431

0 commit comments

Comments
 (0)