Previous: Tests, Up: Statistics [Contents][Index]

Octave can generate random numbers from a large number of distributions. The random number generators are based on the random number generators described in Special Utility Matrices.

The following table summarizes the available random number generators (in alphabetical order).

Distribution | Function |
---|---|

Beta Distribution | `betarnd` |

Binomial Distribution | `binornd` |

Cauchy Distribution | `cauchy_rnd` |

Chi-Square Distribution | `chi2rnd` |

Univariate Discrete Distribution | `discrete_rnd` |

Empirical Distribution | `empirical_rnd` |

Exponential Distribution | `exprnd` |

F Distribution | `frnd` |

Gamma Distribution | `gamrnd` |

Geometric Distribution | `geornd` |

Hypergeometric Distribution | `hygernd` |

Laplace Distribution | `laplace_rnd` |

Logistic Distribution | `logistic_rnd` |

Log-Normal Distribution | `lognrnd` |

Pascal Distribution | `nbinrnd` |

Univariate Normal Distribution | `normrnd` |

Poisson Distribution | `poissrnd` |

Standard Normal Distribution | `stdnormal_rnd` |

t (Student) Distribution | `trnd` |

Univariate Discrete Distribution | `unidrnd` |

Uniform Distribution | `unifrnd` |

Weibull Distribution | `wblrnd` |

Wiener Process | `wienrnd` |

- Function File:
**betarnd***(*`a`,`b`) - Function File:
**betarnd***(*`a`,`b`,`r`) - Function File:
**betarnd***(*`a`,`b`,`r`,`c`, …) - Function File:
**betarnd***(*`a`,`b`, [`sz`]) Return a matrix of random samples from the Beta distribution with parameters

`a`and`b`.When called with a single size argument, return 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 vector of dimensions

`sz`.If no size arguments are given then the result matrix is the common size of

`a`and`b`.

- Function File:
**binornd***(*`n`,`p`) - Function File:
**binornd***(*`n`,`p`,`r`) - Function File:
**binornd***(*`n`,`p`,`r`,`c`, …) - Function File:
**binornd***(*`n`,`p`, [`sz`]) Return a matrix of random samples from the binomial distribution with parameters

`n`and`p`, where`n`is the number of trials and`p`is the probability of success.When called with a single size argument, return 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 vector of dimensions

`sz`.If no size arguments are given then the result matrix is the common size of

`n`and`p`.

- Function File:
**cauchy_rnd***(*`location`,`scale`) - Function File:
**cauchy_rnd***(*`location`,`scale`,`r`) - Function File:
**cauchy_rnd***(*`location`,`scale`,`r`,`c`, …) - Function File:
**cauchy_rnd***(*`location`,`scale`, [`sz`]) Return a matrix of random samples from the Cauchy distribution with parameters

`location`and`scale`.When called with a single size argument, return 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 vector of dimensions

`sz`.If no size arguments are given then the result matrix is the common size of

`location`and`scale`.

- Function File:
**chi2rnd***(*`n`) - Function File:
**chi2rnd***(*`n`,`r`) - Function File:
**chi2rnd***(*`n`,`r`,`c`, …) - Function File:
**chi2rnd***(*`n`, [`sz`]) Return a matrix of random samples from the chi-square distribution with

`n`degrees of freedom.`sz`.If no size arguments are given then the result matrix is the size of

`n`.

- Function File:
**discrete_rnd***(*`v`,`p`) - Function File:
**discrete_rnd***(*`v`,`p`,`r`) - Function File:
**discrete_rnd***(*`v`,`p`,`r`,`c`, …) - Function File:
**discrete_rnd***(*`v`,`p`, [`sz`]) Return a matrix of random samples from the univariate distribution which assumes the values in

`v`with probabilities`p`.`sz`.If no size arguments are given then the result matrix is the common size of

`v`and`p`.

- Function File:
**empirical_rnd***(*`data`) - Function File:
**empirical_rnd***(*`data`,`r`) - Function File:
**empirical_rnd***(*`data`,`r`,`c`, …) - Function File:
**empirical_rnd***(*`data`, [`sz`]) Return a matrix of random samples from the empirical distribution obtained from the univariate sample

`data`.`sz`.If no size arguments are given then the result matrix is a random ordering of the sample

`data`.

- Function File:
**exprnd***(*`lambda`) - Function File:
**exprnd***(*`lambda`,`r`) - Function File:
**exprnd***(*`lambda`,`r`,`c`, …) - Function File:
**exprnd***(*`lambda`, [`sz`]) Return a matrix of random samples from the exponential distribution with mean

`lambda`.`sz`.If no size arguments are given then the result matrix is the size of

`lambda`.

- Function File:
**frnd***(*`m`,`n`) - Function File:
**frnd***(*`m`,`n`,`r`) - Function File:
**frnd***(*`m`,`n`,`r`,`c`, …) - Function File:
**frnd***(*`m`,`n`, [`sz`]) Return a matrix of random samples from the F distribution with

`m`and`n`degrees of freedom.`sz`.If no size arguments are given then the result matrix is the common size of

`m`and`n`.

- Function File:
**gamrnd***(*`a`,`b`) - Function File:
**gamrnd***(*`a`,`b`,`r`) - Function File:
**gamrnd***(*`a`,`b`,`r`,`c`, …) - Function File:
**gamrnd***(*`a`,`b`, [`sz`]) Return a matrix of random samples from the Gamma distribution with shape parameter

`a`and scale`b`.`sz`.If no size arguments are given then the result matrix is the common size of

`a`and`b`.

- Function File:
**geornd***(*`p`) - Function File:
**geornd***(*`p`,`r`) - Function File:
**geornd***(*`p`,`r`,`c`, …) - Function File:
**geornd***(*`p`, [`sz`]) Return a matrix of random samples from the geometric distribution with parameter

`p`.`sz`.If no size arguments are given then the result matrix is the size of

`p`.The geometric distribution models the number of failures (

`x`-1) of a Bernoulli trial with probability`p`before the first success (`x`).

- Function File:
**hygernd***(*`t`,`m`,`n`) - Function File:
**hygernd***(*`t`,`m`,`n`,`r`) - Function File:
**hygernd***(*`t`,`m`,`n`,`r`,`c`, …) - Function File:
**hygernd***(*`t`,`m`,`n`, [`sz`]) Return a matrix of random samples from the hypergeometric distribution with parameters

`t`,`m`, and`n`.The parameters

`t`,`m`, and`n`must be positive integers with`m`and`n`not greater than`t`.`sz`.If no size arguments are given then the result matrix is the common size of

`t`,`m`, and`n`.

- Function File:
**laplace_rnd***(*`r`) - Function File:
**laplace_rnd***(*`r`,`c`, …) - Function File:
**laplace_rnd***([*`sz`]) Return a matrix of random samples from the Laplace distribution.

`sz`.

- Function File:
**logistic_rnd***(*`r`) - Function File:
**logistic_rnd***(*`r`,`c`, …) - Function File:
**logistic_rnd***([*`sz`]) Return a matrix of random samples from the logistic distribution.

`sz`.

- Function File:
**lognrnd***(*`mu`,`sigma`) - Function File:
**lognrnd***(*`mu`,`sigma`,`r`) - Function File:
**lognrnd***(*`mu`,`sigma`,`r`,`c`, …) - Function File:
**lognrnd***(*`mu`,`sigma`, [`sz`]) Return a matrix of random samples from the lognormal distribution with parameters

`mu`and`sigma`.`sz`.If no size arguments are given then the result matrix is the common size of

`mu`and`sigma`.

- Function File:
**nbinrnd***(*`n`,`p`) - Function File:
**nbinrnd***(*`n`,`p`,`r`) - Function File:
**nbinrnd***(*`n`,`p`,`r`,`c`, …) - Function File:
**nbinrnd***(*`n`,`p`, [`sz`]) Return a matrix of random samples from the negative binomial distribution with parameters

`n`and`p`.`sz`.If no size arguments are given then the result matrix is the common size of

`n`and`p`.

- Function File:
**normrnd***(*`mu`,`sigma`) - Function File:
**normrnd***(*`mu`,`sigma`,`r`) - Function File:
**normrnd***(*`mu`,`sigma`,`r`,`c`, …) - Function File:
**normrnd***(*`mu`,`sigma`, [`sz`]) Return a matrix of random samples from the normal distribution with parameters mean

`mu`and standard deviation`sigma`.`sz`.If no size arguments are given then the result matrix is the common size of

`mu`and`sigma`.

- Function File:
**poissrnd***(*`lambda`) - Function File:
**poissrnd***(*`lambda`,`r`) - Function File:
**poissrnd***(*`lambda`,`r`,`c`, …) - Function File:
**poissrnd***(*`lambda`, [`sz`]) Return a matrix of random samples from the Poisson distribution with parameter

`lambda`.`sz`.If no size arguments are given then the result matrix is the size of

`lambda`.

- Function File:
**stdnormal_rnd***(*`r`) - Function File:
**stdnormal_rnd***(*`r`,`c`, …) - Function File:
**stdnormal_rnd***([*`sz`]) Return a matrix of random samples from the standard normal distribution (mean = 0, standard deviation = 1).

`sz`.

- Function File:
**trnd***(*`n`) - Function File:
**trnd***(*`n`,`r`) - Function File:
**trnd***(*`n`,`r`,`c`, …) - Function File:
**trnd***(*`n`, [`sz`]) Return a matrix of random samples from the t (Student) distribution with

`n`degrees of freedom.`sz`.If no size arguments are given then the result matrix is the size of

`n`.

- Function File:
**unidrnd***(*`n`) - Function File:
**unidrnd***(*`n`,`r`) - Function File:
**unidrnd***(*`n`,`r`,`c`, …) - Function File:
**unidrnd***(*`n`, [`sz`]) Return a matrix of random samples from the discrete uniform distribution which assumes the integer values 1–

`n`with equal probability.`n`may be a scalar or a multi-dimensional array.`sz`.If no size arguments are given then the result matrix is the size of

`n`.

- Function File:
**unifrnd***(*`a`,`b`) - Function File:
**unifrnd***(*`a`,`b`,`r`) - Function File:
**unifrnd***(*`a`,`b`,`r`,`c`, …) - Function File:
**unifrnd***(*`a`,`b`, [`sz`]) Return a matrix of random samples from the uniform distribution on [

`a`,`b`].`sz`.If no size arguments are given then the result matrix is the common size of

`a`and`b`.

- Function File:
**wblrnd***(*`scale`,`shape`) - Function File:
**wblrnd***(*`scale`,`shape`,`r`) - Function File:
**wblrnd***(*`scale`,`shape`,`r`,`c`, …) - Function File:
**wblrnd***(*`scale`,`shape`, [`sz`]) Return a matrix of random samples from the Weibull distribution with parameters

`scale`and`shape`.`sz`.If no size arguments are given then the result matrix is the common size of

`scale`and`shape`.

- Function File:
**wienrnd***(*`t`,`d`,`n`) Return a simulated realization of the

`d`-dimensional Wiener Process on the interval [0,`t`]. If`d`is omitted,`d`= 1 is used. The first column of the return matrix contains time, the remaining columns contain the Wiener process.The optional parameter

`n`gives the number of summands used for simulating the process over an interval of length 1. If`n`is omitted,`n`= 1000 is used.

Previous: Tests, Up: Statistics [Contents][Index]