Random | randn >> |
M = rand |
M = rand(n) |
M = rand(x1, x2, ... , xN) |
M = rand(sz) |
M = rand(x1, x2, ... , xN, classname) |
M = rand(x1, x2, ... , xN, 'like', var) |
a variable: n-by-n matrix will be generated.
x1-by-...-by-xN values
a string: 'single' or 'double'
a variable: single or double
a matrix of random numbers.
rand returns a matrix with random elements uniformly distributed on the interval [0, 1].
seed can be modified using rng.
The Mersenne Twister designers consider 5489 as default seed. Nelson uses it as default seed (0).
rng('default');
rand
rng('default');
rand
rng('default');
rand(6)
rng('default');
rand(3, 2, 3)
rng('default');
rand(3, 2, 'single')
rng('default');
v = single([3, 3]);
rand(3, 2, 'like', v)
Version | Description |
---|---|
1.0.0 | initial version |
Allan CORNET