MATLAB中的randi函數


randi Pseudorandom integers from a uniform discrete distribution.來自一個均勻離散分布的偽隨機整數
R = randi(IMAX,N) returns an N-by-N matrix containing pseudorandom integer values drawn from the discrete uniform distribution on 1:IMAX.返回一個N×N的包含偽隨機整數值的矩陣,這些整數來自均勻分布IMAX
randi(IMAX,M,N) or randi(IMAX,[M,N]) returns an M-by-N matrix.
randi(IMAX,M,N,P,...) or randi(IMAX,[M,N,P,...]) returns an M-by-N-by-P-by-... array. randi(IMAX) returns a scalar.
randi(IMAX,SIZE(A)) returns an array the same size as A.
R = randi([IMIN,IMAX],...) returns an array containing integer values drawn from the discrete uniform distribution on IMIN:IMAX.
Note: The size inputs M, N, P, ... should be nonnegative integers.
Negative integers are treated as 0.
R = randi(..., CLASSNAME) returns an array of integer values of class CLASSNAME.
The arrays returned by randi may contain repeated integer values. This is sometimes referred to as sampling with replacement. To get unique integer values, sometimes referred to as sampling without replacement, use RANDPERM.

The sequence of numbers produced by randi is determined by the settings of the uniform random number generator that underlies RAND, RANDN, and randi.
randi uses one uniform random value to create each integer random value. Control that shared random number generator using RNG.



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM