* * $Id: gpgaus.F,v 3.1.1.1 2002/07/11 16:02:00 cafagna Exp $ * * $Log: gpgaus.F,v $ * Revision 3.1.1.1 2002/07/11 16:02:00 cafagna * First GPAMELA release on CVS * * *CMZ : 2.01/00 05/04/2000 14.35.18 by Marialuigia Ambriola *CMZ : 2.00/00 03/03/2000 15.39.05 by Francesco Cafagna *CMZ : 1.01/00 06/05/96 12.57.18 by Francesco Cafagna *-- Author : Francesco Cafagna 03/05/96 REAL FUNCTION GPGAUS(XDUMMY) ************************************************************************ * * * To generate a normally distribute deviate with zero mean and unit variance * * From GASDEV, Numerical recepies $7.3. * * Variables definition: * * IN: * * XDUMMY, dummy argument * * * * Called by: * * Author: Francesco Cafagna, 03/05/96 17.11.14 * * * ************************************************************************ INTEGER ISET REAL V1,V2,GAS1,RVAL(2),R * DATA ISET/0/ * * Generate a random number in the circle of radius 1 * IF (ISET.EQ.0) THEN 10 CALL GRNDM(RVAL,2) V1 = 2.*RVAL(1) -1. V2 = 2.*RVAL(2) -1. R = V1**2 + V2**2 IF(R.GE.1.) GO TO 10 GAS1 = V1 * SQRT(-2.*LOG(R)/R) GPGAUS = V2 * SQRT(-2.*LOG(R)/R) ISET = 1 ELSE GPGAUS = GAS1 ISET = 0 ENDIF * RETURN END