File Exchange

image thumbnail

Random Number Generator in a Range (rand2)

version 2.0.2 (133 KB) by Tamas Kis
Generates a matrix of random numbers between upper and lower bounds. Data type specification (integer, single, double) is available.


Updated 27 Mar 2021

From GitHub

View Version History

View license on GitHub

See or “DOCUMENTATION.pdf” for additional documentation and examples. Examples can also be found in “EXAMPLES.m”.

The "rand2" function is an extension of the built-in "rand" and "randi" functions. While "rand" returns random floats between 0 and 1 and "randi([imin,imax])" returns random integers between imin and imax, the "rand2" function can return a random number (can be specified as either an integer, single-precision floating-point number, or double-precision floating-point number) between two numbers: a lower bound (a) and an upper bound (b).

Cite As

Tamas Kis (2021). Random Number Generator in a Range (rand2) (, GitHub. Retrieved .

Comments and Ratings (2)

Chang hsiung

Chang hsiung

MATLAB Release Compatibility
Created with R2020b
Compatible with R2008b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!