1 |
|
|
|
2 |
|
|
! $Header$ |
3 |
|
|
|
4 |
|
|
SUBROUTINE ran0_vec(npoints, idum, ran0) |
5 |
|
|
|
6 |
|
|
! $Id: ran0_vec.F90 1992 2014-03-05 13:19:12Z lguez $ |
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 |
|
|
! do j=1,npoints |
19 |
|
|
! if (idum(j).eq.0) then |
20 |
|
|
! write(6,*) 'idum=',idum |
21 |
|
|
! write(6,*) 'ZERO seed not allowed' |
22 |
|
|
! stop |
23 |
|
|
! endif |
24 |
|
|
! 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)<0) idum(j) = idum(j) + im |
30 |
|
|
ran0(j) = am*idum(j) |
31 |
|
|
END DO |
32 |
|
|
|
33 |
|
|
END SUBROUTINE ran0_vec |
34 |
|
|
|