# $$\text{WeibullVariate}$$¶

You can use the $$\text{WeibullVariate}$$ function to calculate one or more random variates in a Weibull distribution.

You can use the \weibullv backslash command to insert this function.

The following variants of this function are available:

• $$\text{real } \text{WeibullVariate} \left ( \text{<k>}, \text{<}\lambda\text{>} \right )$$

• $$\text{real } \text{WeibullVariate} \left ( \text{<k>}, \text{<}\lambda\text{>}, \text{<delay>} \right )$$

• $$\text{real matrix } \text{WeibullVariate} \left ( \text{<number rows>}, \text{<number columns>}, \text{<k>}, \text{<}\lambda\text{>} \right )$$

• $$\text{real matrix } \text{WeibullVariate} \left ( \text{<number rows>}, \text{<number columns>}, \text{<k>}, \text{<}\lambda\text{>}, \text{<delay>} \right )$$

Where $$\text{<k>}$$, and $$\text{<}\lambda\text{>}$$ are scalar values representing the value of interest, the shape term, and the scale term respectively. The $$\text{<delay>}$$ term is optional and adds a delay to the calculates variates. The $$\text{WeibullVariate}$$ function is defined over the range $$k > 0$$ and $$\lambda > 0$$ and will generate an error, return NaN or a matrix of NaN for values for which the function is not defined.

The one and two parameter versions return a single value. The three and four parameter versions return a real matrix with dimensions determined by the $$\text{<number rows>}$$ and $$\text{<number columns>}$$ parameters.

The $$\text{WeibullVariate}$$ function calculates random variates by transformation method using:

$\text{WeibullVariate} \left ( x, k, \lambda, delay \right ) = delay + \lambda \left [ - \ln \left ( u \right ) \right ] ^ \frac{1}{k}$

Where $$u$$ is a random variate in a uniform distribution over the range (0, 1]. The matrix version uses SIMD instructions to improve performance.

Figure 222 shows the basic use of the $$\text{WeibullVariate}$$ function.