                      REAL FUNCTION RKRN (DS)                                  
C ======================================================================       
C                   FUNCTION SUBROUTINE RKRN                                    
C                                                                               
C  THIS SUBROUTINE INITIALIZES THE RANDOM NUMBER INSEED VECTOR                  
C  AND UPDATES DSEED EVERY TIME ITS CALLED .                                    
C                                                                               
C  IT IS IDENTICAL TO IMSL'S GGUBFS EXCEPT WHERE SO STATED . JK, TAN 88         
C                                                                               
C* THIS IS A CRAY XM-P VERSION WITH MAXIMUM INTEGER 2**46 - 1                   
C ----------------------------------------------------------------------        
C                                                                               
      REAL*8  DS, D2                                                              
C                                                                               
C --- WITH THIS CHOICE OF DS RKRN [0,1] ----------                              
C     DATA             D2/70368744177663./                                      
C                                                                               
C --- WITH THIS CHOICE OF DS RKRN [0,1) ----------                              
      SAVE D2
      DATA             D2/2147483647.D0/                                      
C                                                                               
          DS  = DMOD(16807.D0 * DS, D2)                                            
          RKRN= DS/D2                                                           
C                                                                               
      RETURN                                                                    
      END                                                                       
