IMSL C Stat Library
random_order_normal
Generates pseudorandom order statistics from a standard normal distribution.
Synopsis
#include <imsls.h>
float *imsls_f_random_order_normal(int ifirst, int ilast, int n…, 0)
The type double function is imsls_d_random_order_normal.
Required Arguments
int ifirst (Input)
First order statistic to generate.
int ilast (Input)
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.
int n (Input)
Size of the sample from which the order statistics arise.
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 standard normal distribution. To release this space, use imsls_free.
Synopsis with Optional Arguments
#include <imsls.h>
float *imsls_f_random_order_normal (int ifirst, int ilast, int n,
IMSLS_RETURN_USER, float r[],
0)
Optional Arguments
IMSLS_RETURN_USER, float r[] (Output)
User-supplied array of length ilast + 1 - ifirst containing the random order statistics in ascending order.
Description
Function imsls_f_random_order_normal generates the ifirst through the ilast order statistics from a pseudorandom sample of size n from a normal (0, 1) distribution. Function imsls_f_random_order_normal uses the function imsls_f_random_order_uniform to generate order statistics from the uniform (0, 1) distribution and then obtains the normal order statistics using the inverse CDF transformation.
Each call to imsls_f_random_order_normal yields an independent event so order statistics from different calls may not have the same order relations with each other.
Example
In this example, imsls_f_random_order_normal is used to generate the fifteenth through the nineteenth order statistics from a sample of size twenty.
 
#include <stdio.h>
#include <imsls.h>
 
int main()
{
float *r = NULL;
 
imsls_random_seed_set(123457);
 
r = imsls_f_random_order_normal(15, 19, 20, 0);
 
printf("The 15th through the 19th order statistics from a \n");
printf("random sample of size 20 from a normal distribution\n");
imsls_f_write_matrix("", 5, 1, r, 0);
}
Output
 
The 15th through the 19th order statistics from a
random sample of size 20 from a normal distribution
 
1 0.4056
2 0.4681
3 0.4697
4 0.9067
5 0.9362