Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿
>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_RANDOM_ORDER

### IMSL_RANDOM_ORDER

IMSL_RANDOM_ORDER

The IMSL_RANDOM_ORDER function generates pseudorandom order statistics from a uniform (0, 1) distribution, or optionally from a standard normal distribution.

Routine IMSL_RANDOM_ORDER generates the Ifirstthrough 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 IMSL_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 IMSL_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 IMSL_RANDOM_ORDER generates the ifirst through the Ilast order statistics from a pseudorandom sample of size n, from a normal (0, 1) distribution.

## Examples

### Example 1

In this example, IMSL_RANDOM_ORDER is used to generate the fifteenth through the nineteenth order statistics from a sample of size twenty.

r = IMSL_RANDOM_ORDER(15, 19, 20)
pm, r

## Syntax

Result = IMSL_RANDOM_ORDER(Ifirst, Ilast, n [, /DOUBLE] [, /NORMAL] [, /UNIFORM])

## Return 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

## Arguments

### Ifirst

First order statistic to generate.

### Ilast

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

## Keywords

### DOUBLE (optional)

If present and nonzero, double precision is used.

### NORMAL (optional)

If present and nonzero, generate pseudorandom order statistics from a standard normal distribution.

### UNIFORM (optional)

If present and nonzero, generate pseudorandom order statistics from a uniform (0, 1) distribution. (Default)

## Version History

 6.4 Introduced