Generate bounded random numbers

Generates uniformly distributed random numbers between two bounds.
45 Downloads
Updated 28 May 2019

View License

A very simple function that generates a set of uniformly-distributed random numbers restricted to be within a specified range. The code is trivial, but nonetheless useful to maximise whitespace in your own code if you need to perform this action regularly.

Cite As

mattpatten.au (2026). Generate bounded random numbers (https://www.mathworks.com/matlabcentral/fileexchange/71660-generate-bounded-random-numbers), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Random Number Generation in Help Center and MATLAB Answers
Version Published Release Notes
1.0.2

Fixed some typos; simplified data checks.

1.0.1

Updated picture.

1.0.0