RANDOM_SORTED is a MATLAB library which generates vectors of random values which are already sorted.
Since the computation of the spacing between the values requires some additional arithmetic, it is not immediately obvious when this procedure will be faster than simply generating a vector of random values and then sorting it.
Because the library can generate a sorted random vector of values between 0 and 1, it is possible to generate sorted data samples from any distribution for which the inverse Cumulative Density Function (CDF) is known. For instance, to generate sorted normal data, simply generate sorted uniform data, and then apply the inverse of the normal CDF, as in the example code listed below.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
RANDOM_SORTED is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.
ASA183, a MATLAB library which implements the Wichman-Hill random number generator (RNG).
MATLAB_RANDOM, MATLAB programs which illustrate the use of Matlab's random number generators.
NORMAL, a MATLAB library which computes a sequence of pseudorandom normally distributed values.
RANDLC, a MATLAB library which generates a sequence of pseudorandom numbers, used by the NAS Benchmark programs.
RANLIB, a MATLAB library which produces random samples from Probability Density Functions (PDF's), including Beta, Chi-square Exponential, F, Gamma, Multivariate normal, Noncentral chi-square, Noncentral F, Univariate normal, random permutations, Real uniform, Binomial, Negative Binomial, Multinomial, Poisson and Integer uniform, by Barry Brown and James Lovato.
RNGLIB, a MATLAB library which implements a random number generator (RNG) with splitting facilities, allowing multiple independent streams to be computed, by L'Ecuyer and Cote.
TOMS515, a MATLAB library which can select subsets of size K from a set of size N. This is a version of ACM TOMS Algorithm 515, by Bill Buckles, Matthew Lybanon.
UNIFORM, a MATLAB library which computes a sequence of uniformly distributed pseudorandom values.
You can go up one level to the MATLAB source codes.