Generate bounded random numbers

Generates uniformly distributed random numbers between two bounds.

You are now following this Submission

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 .

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

Fixed some typos; simplified data checks.

1.0.1

Updated picture.

1.0.0