+--------------------------------------------------------------------+
 |                                                                    |
 |                               RANDOM                               |
 |                                                                    |
 +--------------------------------------------------------------------+

 MEANING: RANDOM subroutine
 CONTEXT: NONMEM utility routine

 USAGE:
      USE SIZES, ONLY: ISIZE,DPSIZE
      INTEGER(KIND=ISIZE) :: KR
      REAL(KIND=DPSIZE) :: R                                            |
      CALL RANDOM (KR,R)

 DISCUSSION:
 The NONMEM utility routine RANDOM may be called (by PRED, PK or ERROR)
 during the Simulation Step (ICALL=4) and when data averages are  being
 computed (ICALL=5) to obtain numbers from different random sources.

 Input argument:

  KR  An  integer  variable or integer constant.  The index of a random
      source.

 Output argument:

  R   A number from the KRth source.  R is double precision with NONMEM |
      7,  and  is single precision with NONMEM VI.  Each time RANDOM is
      called, a new number is output.

 Random sources are defined using the $SIMULATION  record.   Typically,
 the first source is reserved by NONMEM to generate realizations of the
 eta and epsilon variables and/or to randomly mix individuals into dif-
 ferent  subpopulations according to the mixing parameter.  Thus, typi-
 cally, RANDOM must be called with KR > 1.  However,  there  are  cases
 when  NONMEM  itself  needs  no random sources, and all defined random
 sources can be used by PRED (see references).

 A random source that is specified on the $SIMULATION  record  as  NON- |
 PARAMETRIC should not be used to obtain a value of R.

 EXAMPLES OF USAGE:

 WT  (an  item  in  the data record, and a local variable with the same
 name) is generated with a simulated value having mean 70 and  standard
 deviation 7.  The second random source is assumed to be pseudo-normal,
 which is the default distribution for each random source.

 An abbreviated code may use RANDOM explicitly in either  a  simulation
 or a data average block.  When RANDOM is called in abbreviated code, R
 is reserved and is used for the random number.  E.g.,

  IF (ICALL.EQ.4.AND.NEWIND.NE.2) THEN
  CALL RANDOM(2,R)
  ENDIF
  IF (ICALL.EQ.4) WT=70+7*R

REFERENCES: Guide IV Section III.B.13, IV.I
REFERENCES: Guide V Section 12.4.8


  
Go to main index.
  
Created by nmhelp2html v. 1.0 written by Niclas Jonsson (Modified by AJB 5/2006,11/2007,10/2012)