function x = deranged_sample ( a )

%*****************************************************************************80
%
%% deranged_sample() samples the Deranged PDF.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    07 September 2004
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer A, the number of items.
%    1 <= A.
%
%  Output:
%
%    integer X, a sample of the PDF.
%
  cdf = rand ( 1, 1 );

  x = deranged_cdf_inv ( cdf, a );

  return
end
