function x = cardioid_sample ( a, b )

%*****************************************************************************80
%
%% cardioid_sample() samples the Cardioid PDF.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 July 2005
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real A, B, the parameters of the PDF.
%    0.0 <= B <= 0.5.
%
%  Output:
%
%    real X, a sample of the PDF.
%    A - PI <= X <= A + PI.
%
  cdf = rand ( 1, 1 );

  x = cardioid_cdf_inv ( cdf, a, b );

  return
end
