RANDOM_ORDER Function
Generates pseudorandom order statistics from a uniform (0, 1) distribution, or optionally from a standard normal distribution.
Usage
result = RANDOM_ORDER(ifirst, ilast, n)
Input Parameters
ifirstFirst order statistic to generate.
ilastLast order statistic to generate. ilast must be greater than or equal to ifirst. The full set of order statistics from ifirst to ilast is generated. If only one order statistic is desired, set ilast = ifirst.
n—Size of the sample from which the order statistics arise.
Input Keywords
DoubleIf present and nonzero, double precision is used.
UniformIf present and nonzero, generate pseudorandom order statistics from a uniform (0, 1) distribution. (Default)
NormalIf present and nonzero, generate pseudorandom order statistics from a standard normal distribution.
Returned Value
An array of length ilast + 1 - ifirst containing the random order statistics in ascending order.
The first element is the ifirst order statistic in a random sample of size n from the uniform (0, 1) distribution.
Discussion
RANDOM_ORDER generates the ifirst through the ilast order statistics from a pseudorandom sample of size n from a uniform (0, 1) distribution. Depending on the values of ifirst and ilast, different methods of generation are used to achieve greater efficiency. If ifirst = 1 and ilast = n, that is, if the full set of order statistics are desired, the spacings between successive order statistics are generated as ratios of exponential variates. If the full set is not desired, a beta variate is generated for one of the order statistics, and the others are generated as extreme order statistics from conditional uniform distributions. Extreme order statistics from a uniform distribution can be obtained by raising a uniform deviate to an appropriate power.
Each call to RANDOM_ORDER yields an independent event. This means, for example, that if on one call the fourth order statistic is requested and on a second call the third order statistic is requested, the “fourth” may be smaller than the “third”. If both the third and fourth order statistics from a given sample are desired, they should be obtained from a single call to RANDOM_ORDER (by specifying ifirst less than or equal to 3 and ilast greater than or equal to 4).
If the keyword Normal is present and nonzero, then RANDOM_ORDER generates the ifirst through the ilast order statistics from a pseudorandom sample of size n, from a normal (0, 1) distribution
Example
In this example, RANDOM_ORDER is used to generate the fifteenth through the nineteenth order statistics from a sample of size twenty.
r  =  RANDOM_ORDER(15, 19, 20)
PM, r ; PV-WAVE prints the following:
; 0.706909
; 0.808627
; 0.874552
; 0.922146
; 0.957402