source: LMDZ5/branches/testing/libf/phylmd/ran0_vec.F90 @ 3046

Last change on this file since 3046 was 1999, checked in by Laurent Fairhead, 11 years ago

Merged trunk changes r1920:1997 into testing branch

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 675 bytes
RevLine 
[1992]1
[524]2! $Header$
3
[1992]4SUBROUTINE ran0_vec(npoints, idum, ran0)
[524]5
[1992]6  ! $Id: ran0_vec.F90 1999 2014-03-20 09:57:19Z fairhead $
7  ! Platform independent random number generator from
8  ! Numerical Recipies
9  ! Mark Webb July 1999
[524]10
[1992]11  IMPLICIT NONE
[524]12
[1992]13  INTEGER j, npoints, idum(npoints), ia, im, iq, ir, k(npoints)
14  REAL ran0(npoints), am
[524]15
[1992]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
33END SUBROUTINE ran0_vec
34
Note: See TracBrowser for help on using the repository browser.