function [ value, seed ] = r8_randgs ( xmean, sd, seed )

%*****************************************************************************80
%
%% R8_RANDGS generates a normally distributed random number.
%
%  Discussion:
%
%    This function generate a normally distributed random number, that is,
%    it generates 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.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    18 January 2019
%
%  Author:
%
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Richard Hamming,
%    Numerical Methods for Scientists and Engineers,
%    Dover, 1986,
%    ISBN: 0486652416,
%    LC: QA297.H28.
%
%  Parameters:
%
%    Input, real XMEAN, the mean of the Gaussian distribution.
%
%    Input, real SD, the standard deviation of the
%    Gaussian function.
%
%    Input/output, integer SEED, a seed for the random number generator.
%
%    Output, real VALUE, a normally distributed random number.
%
  value = - 6.0;
  for i = 1 : 12
    [ r, seed ] = r8_ren ( seed );
    value = value + r;
  end

  value = xmean + sd * value;

  return
end
