RandIntegers

Version 1.0.0.0 (2 KB) von Skynet
Selects random integers between and inclusive of specified lower and upper limits.
1,5K Downloads
Aktualisiert 17. Jan 2006

Lizenz anzeigen

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.]

Zitieren als

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

Kompatibilität der MATLAB-Version
Erstellt mit R14SP3
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0

Fixed minor error in Summary.