File Exchange

image thumbnail

True Random Integer Generator

version (1.83 KB) by Ameya Deoras
Download true (not pseudo-) random numbers from's generator


Updated 01 Sep 2016

View Version History

View License

The function TRUERAND returns truly random integers using's Random Integer Generator. According to, the numbers are generated based on atmospheric noise and skew-corrected to generate uniform numbers. The generated numbers have been shown to pass the NIST tests for RNGs.
The range of numbers is -1e9 to 1e9 and the maximum number of values that can be generated is 10,000

truerand(rows,cols,min,max) returns a matrix of size rows-by-cols with random integers between min and max.

truerand(n,min,max) returns an n by 1 vector

truerand(n, m), truerand(n) and truerand use the default values min = 1, max = 100

y = truerand
y = truerand(9)
y = truerand(6,6)
y = truerand(5,1,20)
y = truerand(3, 4, 15, 30)

For more information visit

Cite As

Ameya Deoras (2021). True Random Integer Generator (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

Oluwasegun Somefun

Adalberto Polenghi

Hubert Taieb

Good thank you!!
but use data = webread(url) at ligne 56 ; instead of urlread

Nikki Pelot

The download isn't working for me - the zip file only contains an empty license.txt file.

Christina Behrend

When I download the .zip file it just contains an empty license .txt file but no code.

Maneet Goyal


The website url has changed to https and this should be update in the code. Otherwise, this function works great.

JR King

Very nice.

Could you add options to include other types of randomness (gaussian etc)?

Thank you!


Ilya Valmianski

Very nice

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!