Generate uniform pseudo-random integers from linear range.

RAND_INT(R,N) returns an n-by-n matrix containing pseudo-random integer values from range R.

Download
Download

You are now following this Submission

Cite As

DS (2026). Generate uniform pseudo-random integers from linear range. (https://www.mathworks.com/matlabcentral/fileexchange/35324-generate-uniform-pseudo-random-integers-from-linear-range), MATLAB Central File Exchange. Retrieved .

Categories

Find more on Random Number Generation in Help Center and MATLAB Answers

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.4.0

Modified code included as detailed in previous update.

Download
1.3.0

Added a check for imaginary and non-integer range specifications. Thanks to Travis B for pointing out this edge-case behavior.

Download
1.2.0

Fixed help format to accommodate LOOKFOR queries.

Download
1.1.0

Thanks to Jan Simon for suggesting the use of numel instead of abusing the size function (see comments).

Download
1.0.0

Download