UNDIN
This function evaluates the inverse of the discrete uniform cumulative distribution function.
Function Return Value
UNDIN — Integer function value. The probability that a uniform random variable takes a value less than or equal to the returned value is the input probability, P. (Output)
Required Arguments
P — Probability for which the inverse of the discrete uniform cumulative distribution function is to be evaluated. P must be nonnegative and less than or equal to 1.0. (Input)
N — Scale parameter. N must be greater than 0. (Input)
FORTRAN 90 Interface
Generic: UNDIN (P, N)
Specific: The specific interface names are S_UNDIN and D_UNDIN.
FORTRAN 77 Interface
Single: UNDIN (P, N)
Double: The double precision name is DUNDIN.
Description
The notation below uses the floor and ceiling function notation, and .
The function UNDIN evaluates the inverse distribution function of a discrete uniform random variable with scale parameter N, defined
Example
In this example, we evaluate the inverse probability function at P = 0.6, N = 5.
 
USE UMACH_INT
USE UNDIN_INT
IMPLICIT NONE
INTEGER NOUT, N, IX
REAL P
CALL UMACH(2, NOUT)
P = 0.60
N = 5
IX = UNDIN(P, N)
WRITE (NOUT, 99999) P, N, IX
99999 FORMAT (' UNDIN(', F4.2, ', ', I2 ') = ', I2)
END
Output
 
UNDIN(0.60, 5) = 3