randint2.m
来自「现代通信系统(prokis)的所有matlab源程序,对初学者很有帮助的。」· M 代码 · 共 23 行
M
23 行
function out = randint2(varargin);
%RANDINT Generate matrix of uniformly distributed random integers.
% OUT = RANDINT generates a "0" or "1" with equal probability.
%
% OUT = RANDINT(M) generates an M-by-M matrix of random binary numbers.
% "0" and "1" occur with equal probability.
%
% OUT = RANDINT(M,N) generates an M-by-N matrix of random binary numbers.
% "0" and "1" occur with equal probability.
%
% OUT = RANDINT(M,N,RANGE) generates an M-by-N matrix of random integers.
%
% RANGE can be either a scalar or a two-element vector:
% Scalar : If RANGE is a positive integer, then the output integer
% range is [0, RANGE-1]. If RANGE is a negative integer,
% then the output integer range is [RANGE+1, 0].
% Vector : If RANGE is a two-element vector, then the output
% integer range is [RANGE(1), RANGE(2)].
%
% OUT = RANDINT(M,N,RANGE,STATE) resets the state of RAND to STATE.
%
% Examples:
%
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?