subroutine random(rano,var) c***************************************************************************** c This subroutine uses the random number generator "randpan" c to give a pair of random numbers with Gaussian distribution c of mean 0, variance var. c To transfer the random number from the generator which is c between 0 and 1, we apply the polar algorithm from Knuth's c book with a small change to satisfy the variance condition. c input : var, the variance of random numbers. c output: rano contains the pair of numbers we want. c************************************************************************** dimension rano(2) 1 do 3 i = 1,2 rano(i) = 2.*rannyu(0)-1. 3 continue s = rano(1)**2+rano(2)**2 if(s .ge. 1. .or. s .eq. 0.) go to 1 do 5 i = 1,2 rano(i) = sqrt(var)*rano(i)*sqrt(-2.*alog(s)/s) 5 continue return end