random

Generate random samples from a distribution.

Syntax

rnd=random(d,p1,p2,....pN)

rnd=random(d,p1,p2,....pN,r,c)

Inputs

d
Distribution name.
Type: char | string
Dimension: string
pX
Distribution parameters.
Type: integer
Dimension: scalar
r,c
Number of matrix rows and columns.
Type: integer
Dimension: scalar | vector | matrix

Outputs

R
Random values.

Example

Vector random example with beta distribution.

p1 = 2;
p2 = 5;
r = 1;
c = 10;
rnd = random('beta',p1,p2,r,c)
rnd = [Matrix] 1 x 10
0.21841 0.17461 0.045617 0.31058 0.57768 0.21541 0.20936 0.35725 0.28194 0.158851

Comments

The random number generator can be initialized using rand or randn.