function hypergeometric_sample_test ( )

%*****************************************************************************80
%
%% HYPERGEOMETRIC_SAMPLE_TEST tests HYPERGEOMETRIC_SAMPLE.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    08 April 2016
%
%  Author:
%
%    John Burkardt
%
  nsample = 1000;
  seed = 123456789;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'HYPERGEOMETRIC_SAMPLE_TEST\n' );
  fprintf ( 1, '  For the PDF:\n' );
  fprintf ( 1, '  HYPERGEOMETRIC_MEAN computes the Hypergeometric mean;\n' );
  fprintf ( 1, '  HYPERGEOMETRIC_SAMPLE samples the Hypergeometric distribution;\n' );
  fprintf ( 1, '  HYPERGEOMETRIC_VARIANCE computes the Hypergeometric variance.\n' );

  n = 10;
  m = 7;
  l = 100;

  check = hypergeometric_check ( n, m, l );

  if ( ~ check );
    fprintf ( 1, '\n' );
    fprintf ( 1, 'HYPERGEOMETRIC_SAMPLE_TEST - Fatal error!\n' );
    fprintf ( 1, '  The parameters are not legal.\n' );
    return
  end

  mean = hypergeometric_mean ( n, m, l );
  variance = hypergeometric_variance ( n, m, l );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  PDF parameter N =             %6d\n', n );
  fprintf ( 1, '  PDF parameter M =             %6d\n', m );
  fprintf ( 1, '  PDF parameter L =             %6d\n', l );
  fprintf ( 1, '  PDF mean =                    %14g\n', mean );
  fprintf ( 1, '  PDF variance =                %14g\n', variance );

  for i = 1 : nsample
    [ x(i), seed ] = hypergeometric_sample ( n, m, l, seed );
  end

  mean = i4vec_mean ( nsample, x );
  variance = i4vec_variance ( nsample, x );
  xmax = i4vec_max ( nsample, x );
  xmin = i4vec_min ( nsample, x );

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

  return
end
