Changeset 1342 for palm/trunk/SOURCE/random_gauss.f90
 Timestamp:
 Mar 26, 2014 5:04:47 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

palm/trunk/SOURCE/random_gauss.f90
r1321 r1342 20 20 ! Current revisions: 21 21 !  22 ! 22 ! REAL constants defined as wpkind 23 23 ! 24 24 ! Former revisions: … … 78 78 79 79 IF ( iset == 0 ) THEN 80 rsq = 0.0 81 DO WHILE ( rsq >= 1.0 .OR. rsq == 0.0)82 v1 = 2.0 * random_function( idum )  1.083 v2 = 2.0 * random_function( idum )  1.080 rsq = 0.0_wp 81 DO WHILE ( rsq >= 1.0_wp .OR. rsq == 0.0_wp ) 82 v1 = 2.0_wp * random_function( idum )  1.0_wp 83 v2 = 2.0_wp * random_function( idum )  1.0_wp 84 84 rsq = v1**2 + v2**2 85 85 ENDDO 86 fac = SQRT( 2.0 * LOG( rsq ) / rsq )86 fac = SQRT( 2.0_wp * LOG( rsq ) / rsq ) 87 87 gset = v1 * fac 88 random_gauss = v2 * fac + 1.0 88 random_gauss = v2 * fac + 1.0_wp 89 89 iset = 1 90 90 ELSE 91 random_gauss = gset + 1.0 91 random_gauss = gset + 1.0_wp 92 92 iset = 0 93 93 ENDIF 94 94 95 IF ( ABS( random_gauss  1.0 ) <= upper_limit ) EXIT95 IF ( ABS( random_gauss  1.0_wp ) <= upper_limit ) EXIT 96 96 97 97 ENDDO
Note: See TracChangeset
for help on using the changeset viewer.