function [rgaussresult,xmean,sd]=rgauss(xmean,sd);
rgaussresult=[];
persistent i rgauss ;
if isempty(i), i=0; end;
if isempty(rgaussresult), rgaussresult=0; end;
%***BEGIN PROLOGUE RGAUSS
%***PURPOSE Generate a normally distributed (Gaussian) random number.
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY L6A14
%***TYPE SINGLE PRECISION (RGAUSS-S)
%***KEYWORDS FNLIB, GAUSSIAN, NORMAL, RANDOM NUMBER, SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% Generate a normally distributed random number, i.e., generate random
% numbers with a Gaussian distribution. These random numbers are not
% exceptionally good -- especially in the tails of the distribution,
% but this implementation is simple and suitable for most applications.
% See R. W. Hamming, Numerical Methods for Scientists and Engineers,
% McGraw-Hill, 1962, pages 34 and 389.
%
% Input Arguments --
% XMEAN the mean of the Guassian distribution.
% SD the standard deviation of the Guassian function
% EXP (-1/2 * (X-XMEAN)**2 / SD**2)
%
%***REFERENCES (NONE)
%***ROUTINES CALLED RAND
%***REVISION HISTORY (YYMMDD)
% 770401 DATE WRITTEN
% 861211 REVISION DATE from Version 3.2
% 891214 Prologue converted to Version 4.0 format. (BAB)
% 910819 Added EXTERNAL statement for RAND due to problem on IBM
% RS 6000. (WRB)
%***end PROLOGUE RGAUSS
%***FIRST EXECUTABLE STATEMENT RGAUSS
rgaussresult = -6.0;
for i = 1 : 12;
rgaussresult = rgaussresult + rand(0.0);
end; i = fix(12+1);
%
rgaussresult = xmean + sd.*rgaussresult;
%
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',xmean); evalin('caller',[inputname(1),'=FUntemp;']); end
if csnil&&~isempty(inputname(2)), assignin('caller','FUntemp',sd); evalin('caller',[inputname(2),'=FUntemp;']); end
end
%DECK RG