matlab随机函数图像生成(Matlab内置的五种随机函数)
matlab随机函数图像生成(Matlab内置的五种随机函数)randperm(n) 产生一个1到n的随机顺序。randsrc(m n [alphabet; prob]) generates an m-by-n matrix with each entry independently chosen from the entries in the row vector alphabet. Duplicate values in alphabet are ignored. The row vector prob lists corresponding probabilities in prob.产生在[1 imax] 均匀分布的伪随机整数。randi(imax) returns a pseudorandom scalar integer between 1 and imax.randsrc(m n [alphabet; prob]) 产生一个
1、rand-均匀分布rand 产生由在(0 1)之间均匀分布的随机数。
rand returns a single uniformly distributed random number in the interval (0 1).
2、randn-正态分布randn 产生均值为0,方差为1的标准正态分布的随机数。
randn returns a random scalar drawn from the standard normal distribution.
3、randi-指定范围均匀分布产生在[1 imax] 均匀分布的伪随机整数。
randi(imax) returns a pseudorandom scalar integer between 1 and imax.
4、randsrc-指定概率随机分布randsrc(m n [alphabet; prob]) 产生一个m-by-n的矩阵,矩阵的元素从alphabet里抽取,alphabet每个元素被抽中的概率由prob指定。
randsrc(m n [alphabet; prob]) generates an m-by-n matrix with each entry independently chosen from the entries in the row vector alphabet. Duplicate values in alphabet are ignored. The row vector prob lists corresponding probabilities in prob.
5、randperm-随机排序randperm(n) 产生一个1到n的随机顺序。
randperm(n) returns a row vector containing a random permutation of the integers from 1 to n inclusive.