function subset_distance_pdf ( m )

%*****************************************************************************80
%
%% subset_distance_pdf() plots the PDF for the subset distance problem.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 January 2021
%
%  Author:
%
%    John Burkardt
%
  d = linspace ( 0.0, m, m + 1 );

  pdf = zeros ( m + 1, 1 );
  for k = 0 : m
    pdf(k+1) = nchoosek ( m, k );
  end
  pdf = pdf / 2^m

  plot ( d, pdf, 'r-', 'linewidth', 2 );
  grid ( 'on' );
  xlabel ( '<-- Distance -->' );
  ylabel ( '<-- Probability -->' );
  title_string = sprintf ( ...
    'PDF for distance of random subsets of a %d set', m );
  title ( title_string );

  return
end

