@@ -1476,28 +1476,20 @@ def uniform(low=0.0, high=1.0, size=None):
1476
1476
uniform(low=0.0, high=1.0, size=None)
1477
1477
1478
1478
Draw samples from a uniform distribution.
1479
- Samples are uniformly distributed over the half-open interval
1480
- ``[low, high)`` (includes low, but excludes high). In other words,
1481
- any value within the given interval is equally likely to be drawn
1482
- by `uniform`.
1483
1479
1484
- Parameters
1485
- ----------
1486
- low : float, optional
1487
- Lower boundary of the output interval. All values generated will be
1488
- greater than or equal to low. The default value is 0.
1489
- high : float
1490
- Upper boundary of the output interval. All values generated will be
1491
- less than high. The default value is 1.0.
1492
- size : int or tuple of ints, optional
1493
- Output shape. If the given shape is, e.g., ``(m, n, k)``, then
1494
- ``m * n * k`` samples are drawn. If size is ``None`` (default),
1495
- a single value is returned if ``low`` and ``high`` are both scalars.
1480
+ For full documentation refer to :obj:`numpy.random.uniform`.
1496
1481
1497
- Returns
1498
- -------
1499
- out : array or scalar
1500
- Drawn samples from the parameterized uniform distribution.
1482
+ Limitations
1483
+ -----------
1484
+ Parameters ``low`` and ``high`` are supported as scalar.
1485
+ Otherwise, :obj:`numpy.random.uniform(low, high, size)` samples are drawn.
1486
+ Output array data type is :obj:`dpnp.float64`.
1487
+
1488
+ Examples
1489
+ --------
1490
+ Draw samples from the distribution:
1491
+ >>> low, high = 0, 0.1 # low and high
1492
+ >>> s = dpnp.random.uniform(low, high, 10000)
1501
1493
1502
1494
See Also
1503
1495
--------
@@ -1506,16 +1498,14 @@ def uniform(low=0.0, high=1.0, size=None):
1506
1498
"""
1507
1499
1508
1500
if not use_origin_backend (low ):
1509
- if low == high :
1510
- # TODO:
1511
- # currently dparray.full is not implemented
1512
- # return dpnp.dparray.dparray.full(size, low, dtype=numpy.float64)
1513
- message = "`low` equal to `high`, should return an array, filled with `low` value."
1514
- message += " Currently not supported. See: numpy.full TODO"
1515
- checker_throw_runtime_error ("uniform" , message )
1516
- elif low > high :
1517
- low , high = high , low
1518
- return dpnp_uniform (low , high , size , dtype = numpy .float64 )
1501
+ if not dpnp .isscalar (low ):
1502
+ pass
1503
+ elif not dpnp .isscalar (high ):
1504
+ pass
1505
+ else :
1506
+ if low > high :
1507
+ low , high = high , low
1508
+ return dpnp_uniform (low , high , size , dtype = numpy .float64 )
1519
1509
1520
1510
return call_origin (numpy .random .uniform , low , high , size )
1521
1511
0 commit comments