function deranged_cdf_test ( )

%*****************************************************************************80
%
%% deranged_cdf_test() tests deranged_cdf(), deranged_cdf_inv(), deranged_pdf();
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 April 2009
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'DERANGED_CDF_TEST():\n' );
  fprintf ( 1, '  DERANGED_CDF() evaluates the Deranged CDF;\n' );
  fprintf ( 1, '  DERANGED_CDF_INV() inverts the Deranged CDF.\n' );
  fprintf ( 1, '  DERANGED_PDF() evaluates the Deranged PDF;\n' );

  a = 7;

  check = deranged_check ( a );

  if ( ~check );
    fprintf ( 1, '\n' );
    fprintf ( 1, 'deranged_cdf_test(): Fatal error!\n' );
    fprintf ( 1, '  The parameters are not legal.\n' );
    return
  end
  
  fprintf ( 1, '\n' );
  fprintf ( 1, '  PDF parameter A = %14g\n', a );

  fprintf ( 1, '\n' );
  fprintf ( 1, '       X            PDF           CDF            CDF_INV\n' );
  fprintf ( 1, '\n' );

  for x = 0, a

    pdf = deranged_pdf ( x, a );

    cdf = deranged_cdf ( x, a );

    x2 = deranged_cdf_inv ( cdf, a );

    fprintf ( 1, '  %14d  %14g  %14g  %14d\n', x, pdf, cdf, x2 );

  end

  return
end
