RandIntegers

バージョン 1.0.0.0 (2 KB) 作成者: Skynet
Selects random integers between and inclusive of specified lower and upper limits.
ダウンロード: 1.5K
更新 2006/1/17

ライセンスの表示

RANDINTEGERS(LOWER_BOUND,UPPER_BOUND) is a one line function that uses RAND to return a random integer between and inclusive of the two specified integers LOWER_BOUND and UPPER_BOUND (with uniform probability) (and with replacement).

The third argument M_SIZE is optional. If specified as a scalar, the output is a matrix with size [m_size m_size] and containing the values stated above. If specified as a row vector, the output is an array with size [m_size] and containing the same.

Examples:

randinteger(11,25) may return 23 or 25 or 11
randinteger(11,25,2) may return [25 12; 15 24]
randinteger(11,25,[1 3]) may return [14 23 17]

Remarks:

As depicted in the help text within the function, the Communications and Statistics toolboxes each contain a function that can be used for the same purpose.

[Please subscribe to this file if you use it, so you can be notified of updates.]

引用

Skynet (2024). RandIntegers (https://www.mathworks.com/matlabcentral/fileexchange/6207-randintegers), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R14SP3
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0

Fixed minor error in Summary.