function [ x, seed ] = beta_binomial_sample ( a, b, c, seed )

%*****************************************************************************80
%
%% BETA_BINOMIAL_SAMPLE samples the Beta Binomial CDF.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    08 October 2004
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real A, B, parameters of the PDF.
%    0.0 < A,
%    0.0 < B.
%
%    Input, integer C, a parameter of the PDF.
%    0 <= C.
%
%    Input, integer SEED, a seed for the random number generator.
%
%    Output, integer X, a sample of the PDF.
%
%    Output, integer SEED, an updated seed for the random number generator.
%
  [ cdf, seed ] = r8_uniform_01 ( seed );

  x = beta_binomial_cdf_inv ( cdf, a, b, c );

  return
end
