function benford_sample_test ( )

%*****************************************************************************80
%
%% benford_sample_test() tests benford_mean(), benford_sample(), benford_variance().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 November 2022
%
%  Author:
%
%    John Burkardt
%
  nsample = 10000;
 
  fprintf ( 1, '\n' );
  fprintf ( 1, 'benford_sample_test():\n' );
  fprintf ( 1, '  benford_mean() computes the Benford mean;\n' );
  fprintf ( 1, '  benford_sample() samples the Benford distribution;\n' );
  fprintf ( 1, '  benford_variance() computes the benford variance.\n' );

  pdf_mean = benford_mean ( );
  pdf_var = benford_variance ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  PDF mean =        %14f\n', pdf_mean );
  fprintf ( 1, '  PDF variance =    %14f\n', pdf_var );

  x = zeros ( nsample, 1 );
  for i = 1 : nsample
    x(i) = benford_sample ( );
  end

  xmean = mean ( x );
  xvar = var ( x );
  xmax = max ( x );
  xmin = min ( x );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Sample size =     %6d\n', nsample );
  fprintf ( 1, '  Sample mean =     %14f\n', xmean );
  fprintf ( 1, '  Sample variance = %14f\n', xvar );
  fprintf ( 1, '  Sample maximum =  %6d\n', xmax );
  fprintf ( 1, '  Sample minimum =  %6d\n', xmin );

  return
end
