source:
LMDZ.3.3/trunk/libf/phylmd/ran0_vec.F
@
3419
Last change on this file since 3419 was 465, checked in by , 21 years ago | |
---|---|
|
|
File size: 712 bytes |
Line | |
---|---|
1 | subroutine ran0_vec(npoints,idum,ran0) |
2 | |
3 | ! $Id: ran0_vec.F 465 2003-08-06 14:45:44Z acozic $ |
4 | ! Platform independent random number generator from |
5 | ! Numerical Recipies |
6 | ! Mark Webb July 1999 |
7 | |
8 | implicit none |
9 | |
10 | integer j,npoints,idum(npoints),IA,IM,IQ,IR,k(npoints) |
11 | real ran0(npoints),AM |
12 | |
13 | parameter (IA=16807, IM=2147483647, AM=1.0/IM, IQ=127773, IR=2836) |
14 | |
15 | c do j=1,npoints |
16 | c if (idum(j).eq.0) then |
17 | c write(6,*) 'idum=',idum |
18 | c write(6,*) 'ZERO seed not allowed' |
19 | c stop |
20 | c endif |
21 | c enddo |
22 | |
23 | do j=1,npoints |
24 | k(j)=idum(j)/IQ |
25 | idum(j)=IA*(idum(j)-k(j)*IQ)-IR*k(j) |
26 | if (idum(j).lt.0) idum(j)=idum(j)+IM |
27 | ran0(j)=AM*idum(j) |
28 | enddo |
29 | |
30 | end |
31 |
Note: See TracBrowser
for help on using the repository browser.