|||
randperm Random permutation.
P = randperm(N) returns a vector containing a random permutation of the
integers 1:N. For example, randperm(6) might be [2 4 5 6 1 3].
P = randperm(N,K) returns a row vector containing K unique integers
selected randomly from 1:N. For example, randperm(6,3) might be [4 2 5].
randperm(N,K) returns a vector of K unique values. This is sometimes
referred to as a K-permutation of 1:N or as sampling without replacement.
To allow repeated values in the selection, sometimes referred to as
sampling with replacement, use RANDI(N,1,K).
randperm calls RAND and therefore changes the state of the random number
generator that underlies RAND, RANDI, and RANDN. Control that shared
generator using RNG.
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-5-17 13:30
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社