My Project
 All Classes Files Functions Variables Macros
ran0_vec.F
Go to the documentation of this file.
1 !
2 ! $Header$
3 !
4  subroutine ran0_vec(npoints,idum,ran0)
5 
6 ! $Id: ran0_vec.F 524 2004-05-19 12:53:04Z lmdzadmin $
7 ! Platform independent random number generator from
8 ! Numerical Recipies
9 ! Mark Webb July 1999
10 
11  implicit none
12 
13  integer j,npoints,idum(npoints),ia,im,iq,ir,k(npoints)
14  real ran0(npoints),am
15 
16  parameter(ia=16807, im=2147483647, am=1.0/im, iq=127773, ir=2836)
17 
18 c do j=1,npoints
19 c if (idum(j).eq.0) then
20 c write(6,*) 'idum=',idum
21 c write(6,*) 'ZERO seed not allowed'
22 c stop
23 c endif
24 c enddo
25 
26  do j=1,npoints
27  k(j)=idum(j)/iq
28  idum(j)=ia*(idum(j)-k(j)*iq)-ir*k(j)
29  if (idum(j).lt.0) idum(j)=idum(j)+im
30  ran0(j)=am*idum(j)
31  enddo
32 
33  end
34