random number generator
rand(m1,m2,.. [,key]) rand(x [, key]) rand() rand(key) rand("seed" [,n]) rand("info")
integers
character string with value in "uniform",
"normal"
a matrix. Only its dimensions are taken into account.
random matrix generator.
Warning: without a seed, the sequence will remain the same from a session to the other.
At the beginning of each script using rand function, you should use:
rand('seed',getdate('s'))
Without key argument the syntaxes below produce random matrices with the current random generator (default is "uniform")
is a random matrix of dimension m1 by
m2.
is a random matrix of dimension m1 by
m2,.. by mn.
is a random matrix of same size as a.
rand(a) is complex if a is a
complex matrix.
each time it is referenced.
If present, the key argument allows to specifie an other random distribution.
The current random generator is set to a uniform random generator. Random numbers are uniformly distributed in the interval (0,1).
The current random generator is set to a Gaussian (with mean 0 and variance 1) random number generator.
return the type of the default random generator ('uniform' or 'normal')
IT is possible to (re-)initialize the seed of the rand generator:
returns the current value of the seed.
puts the seed to n. (by default
n=0 at first call).
Use the more powerful function grand instead.
x=rand(10,10,'uniform') rand('normal') rand('info') y=rand(x,'normal'); x=rand(2,2,2)