cupy.random.triangular#
- cupy.random.triangular(left, mode, right, size=None, dtype=<class 'float'>)[source]#
Triangular distribution.
Returns an array of samples drawn from the triangular distribution. Its probability density function is defined as
\[\begin{split}f(x) = \begin{cases} \frac{2(x-l)}{(r-l)(m-l)} & \text{for } l \leq x \leq m, \\ \frac{2(r-x)}{(r-l)(r-m)} & \text{for } m \leq x \leq r, \\ 0 & \text{otherwise}. \end{cases}\end{split}\]- Parameters
left (float) – Lower limit \(l\).
mode (float) – The value where the peak of the distribution occurs. \(m\).
right (float) – Higher Limit \(r\).
size (int or tuple of ints) – The shape of the array. If
None
, a zero-dimensional array is generated.dtype – Data type specifier. Only
numpy.float32
andnumpy.float64
types are allowed.
- Returns
Samples drawn from the triangular distribution.
- Return type
See also