randint.m
上传用户:loeagle
上传日期:2013-03-02
资源大小:1236k
文件大小:4k
- function out = randint(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:
- %