# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# chi2rnd

Chi-square random numbers

## Syntax

```R = chi2rnd(V) R = chi2rnd(V,m,n,...) R = chi2rnd(V,[m,n,...]) ```

## Description

`R = chi2rnd(V)` generates random numbers from the chi-square distribution with degrees of freedom parameters specified by `V`. `V` can be a vector, a matrix, or a multidimensional array. `R` is the same size as `V`. The degrees of freedom parameters in `V` must be positive.

`R = chi2rnd(V,m,n,...)` or `R = chi2rnd(V,[m,n,...])` generates an `m`-by-`n`-by-... array containing random numbers from the chi-square distribution with degrees of freedom parameter `V`. `V` can be a scalar or an array of the same size as `R`.

## Examples

Note that the first and third commands are the same, but are different from the second command.

```r = chi2rnd(1:6) r = 0.0037 3.0377 7.8142 0.9021 3.2019 9.0729 r = chi2rnd(6,[1 6]) r = 6.5249 2.6226 12.2497 3.0388 6.3133 5.0388 r = chi2rnd(1:6,1,6) r = 0.7638 6.0955 0.8273 3.2506 1.5469 10.9197```