### Function Reference: `trirnd`

statistics: r = trirnd (a, b, c)
statistics: r = trirnd (a, b, c, rows)
statistics: r = trirnd (a, b, c, rows, cols, …)
statistics: r = trirnd (a, b, c, [sz])

Random arrays from the triangular distribution.

`r = trirnd (sigma)` returns an array of random numbers chosen from the triangular distribution with lower limit parameter a, peak location (mode) parameter b, and upper limit parameter c. The size of r is the common size of a, b, and c. A scalar input functions as a constant matrix of the same size as the other inputs.

When called with a single size argument, `trirnd` returns a square matrix with the dimension specified. When called with more than one scalar argument, the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions. The size may also be specified with a row vector of dimensions, sz.

Note that the order of the parameter input arguments has been changed after statistics version 1.6.3 in order to be MATLAB compatible with the parameters used in the TriangularDistribution probability distribution object. More specifically, the positions of the parameters b and c have been swapped. As a result, the naming conventions no longer coinside with those used in Wikipedia, in which b denotes the upper limit and c denotes the mode or peak parameter.

Further information about the triangular distribution can be found at https://en.wikipedia.org/wiki/Triangular_distribution

See also: tricdf, triinv, tripdf, tristat

Source Code: trirnd