unifrnd

Generate random data from a uniform distribution.

Syntax

unifrnd(a,b)

unifrnd(a,b,r,c)

Inputs

a
Lower bound (default = 0).
Type: double
Dimension: scalar | vector | matrix
b
Upper bound (default = 1.)
Type: double
Dimension: scalar | vector | matrix
r,c
Number of matrix rows and columns.
Type: integer
Dimension: scalar

Outputs

rnd
Random data.

Examples

Single value unifrnd example:
a = 3;
b = 5;
rnd = unifrnd(a,b)
rnd = 4.0976
Vector unifrnd example:
a = 3;
b = 5;
r = 1;
c = 5;
rnd = unifrnd(a,b,r,c)
rnd = [Matrix] 1 x 5
4.0976 4.1857 4.4304 4.6885 4.2055

Comments

The random number generator can be initialized using rand.