Blame view
fvn_fnlib/randgs.f
783 Bytes
38581db0c git-svn-id: https... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
function randgs (xmean, sd) c c generate a normally distributed random number, i.e., generate random c numbers with a gaussian distribution. these random numbers are not c exceptionally good -- especially in the tails of the distribution, c but this implementation is simple and suitable for most applications. c see r. w. hamming, numerical methods for scientists and engineers, c mcgraw-hill, 1962, pages 34 and 389. c c input arguments -- c xmean the mean of the gaussian distribution. c sd the standard deviation of the gaussian function c exp (-1/2 * (x-xmean)**2 / sd**2) c external rand c randgs = -6. do 10 i=1,12 randgs = randgs + rand(0.) 10 continue c randgs = xmean + sd*randgs c return end |