function i4_binomial_sample_test ( )

%*****************************************************************************80
%
%% i4_binomial_sample_test() tests i4_binomial_sample().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    25 January 2018
%
%  Author:
%
%    John Burkardt
%
  initialize ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'i4_binomial_sample_test():\n' );
  fprintf ( 1, '  i4_binomial_sample() samples the binomial distribution.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '   N         P   K        PDF\n' );
  fprintf ( 1, '\n' );
 
  for i = 1 : 10

    n = i4_uniform_sample ( 1, 20 );
    p = r8_uniform_sample ( 0.0, 1.0 );
    k = i4_binomial_sample ( n, p );
    pdf = i4_binomial_pdf ( n, p, k );
    fprintf ( 1, '  %2d  %8.4f  %2d  %14.6g\n', n, p, k, pdf );

  end

  return
end
