# 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.

# random

Class: piecewisedistribution

Random numbers from piecewise distribution

## Syntax

```r = random(obj) R = random(obj,n) R = random(obj,m,n) R = random(obj,[m,n]) R = random(obj,m,n,p,...) R = random(obj,[m,n,p,...]) ```

## Description

`r = random(obj)` generates a pseudo-random number `r` drawn from the piecewise distribution object `obj`.

`R = random(obj,n)` generates an n-by-n matrix of pseudo-random numbers `R`.

`R = random(obj,m,n)` or `R = random(obj,[m,n])` generates an m-by-n matrix of pseudo-random numbers `R`.

`R = random(obj,m,n,p,...)` or ```R = random(obj,[m,n,p,...])``` generates an m-by-n-by-p-by-... array of pseudo-random numbers `R`.

## Examples

Fit Pareto tails to a t distribution at cumulative probabilities 0.1 and 0.9:

```t = trnd(3,100,1); obj = paretotails(t,0.1,0.9); r = random(obj) r = 0.8285```