function x = beta_binomial_sample ( a, b, c )

%*****************************************************************************80
%
%% beta_binomial_sample() samples the Beta Binomial CDF.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    07 April 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real A, B, parameters of the PDF.
%    0.0 < A,
%    0.0 < B.
%
%    integer C, a parameter of the PDF.
%    0 <= C.
%
%  Output:
%
%    integer X, a sample of the PDF.
%
  cdf = rand ( 1, 1 );

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

  return
end
