The triangular distribution has density
$$f(x)=2*(x-min) / ((max-min)*(mode-min)) (min < x <= mode)$$
$$f(x)=2*(max-x) / ((max-min)*(max-mode)) (mode < x < max)$$
and 0 elsewhere.
The mean is
$$\frac{1}{3}(min + mode + max)$$
and the variance is
$$\frac{1}{18}(min^2 + mode^2 + max^2 - min*mode - min*max - mode*max)$$
The default values of min, max and mode give a distribution with
mean 0 and unit variance.
If min>max, min amd max will be silently interchanged. If
mode is not within [min, max], the functions return NA, with a warning.
rtri calls runif(n, 0, 1) to generate probabilities which are passed to
qtri.