1 double precision function util_random(iseed) 2 implicit none 3 integer iseed 4#include "errquit.fh" 5c $Id$ 6c 7c routine to give a random number [0,1] 8c 9c iseed is an integer seed when non-zero used to initialize the sequence 10c 11#if defined(IBM) || defined(SP1) || ( defined(BGQ) && !defined(GFORTRAN) ) 12 if(iseed.gt.0) call srand(dble(iseed)) 13 util_random=rand() 14#elif defined(SGI) || defined(SGITFP) 15 real*8 rand 16 external rand 17 if(iseed.gt.0) call srand(dble(iseed)) 18 util_random=rand() 19#elif defined(CRAY) 20 if(iseed.gt.0) call ranset(iseed) 21 util_random=ranf() 22#elif defined(LINUX) || defined (MACX) 23 double precision linux_rand 24 external linux_rand 25 if(iseed.gt.0) call linux_sran(iseed) 26 util_random=linux_rand() 27#else 28 call errquit(' random routine missing', 0,CAPMISS_ERR) 29#endif 30 end 31 32 33