function r8vec_normal_01_test ( )

%*****************************************************************************80
%
%% r8vec_normal_01_test() tests r8vec_normal_01().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 April 2009
%
%  Author:
%
%    John Burkardt
%
  n_max = 1000;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8vec_normal_01_test():\n' );
  fprintf ( 1, '  r8vec_normal_01() computes a vector of normally\n' );
  fprintf ( 1, '  distributed random numbers.\n' );
%
%  Simply call 5 times for 1 value, and print.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Test #1: Call 5 times, 1 value each time.\n' );
  fprintf ( 1, '\n' );

  n = 1;
  for i = 1 : 5
    x = r8vec_normal_01 ( 1 );
    fprintf ( 1, '  %6d  %12f\n', i, x(1) );
  end
%
%  Compute 5 values at once.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Call 1 time for 5 values.\n' );
  fprintf ( 1, '\n' );

  x = r8vec_normal_01 ( 5 );

  for i = 1 : n
    fprintf ( 1, '  %6d  %12f\n', i, x(i) );
  end
%
%  Determine the minimum, maximum, mean and variance.
%
  n = n_max;
  x = r8vec_normal_01 ( n );
  x_min = min ( x(1:n) );
  x_max = max ( x(1:n) );
  x_mean = sum ( x(1:n) ) / n;
  x_var = sum ( ( x(1:n) - x_mean ).^2 ) / ( n - 1 );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of samples was %d\n', n );
  fprintf ( 1, '  Minimum value was %f\n', x_min );
  fprintf ( 1, '  Maximum value was %f\n', x_max );
  fprintf ( 1, '  Average value was %f\n', x_mean );
  fprintf ( 1, '  Variance was      %f\n', x_var );
  fprintf ( 1, '  Expected average  %f\n', 0.0 );
  fprintf ( 1, '  Expected variance %f\n', 1.0 );

  return
end
