function xyhisto ( trial_num )

%*****************************************************************************80
%
%% xyhisto() makes a histogram of X^Y.
%
%  Discussion:
%
%    This code produces values of X raised to the Y power,
%    where X and Y are both uniform from 0 to 1, and independent. It
%    then plots a histogram of the values using 100 bins.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 January 2018
%
%  Author:
%
%    Paul Nahin
%
%  Reference:
%
%    Paul Nahin,
%    Dueling Idiots and Other Probability Puzzlers,
%    Princeton, 2012,
%    ISBN: 978-0691155005.
%
%  Input:
%
%    integer trial_num: the number of trials.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'xyhisto():\n' );
  fprintf ( 1, '  Produce %d values of X raised to the Y power,\n', trial_num );
  fprintf ( 1, '  where X and Y are both uniform from 0 to 1, and independent.\n' );
  fprintf ( 1, '  Then plot a histogram of the values using 100 bins.\n' );

  for pair = 1 : trial_num
    x = rand ( );
    y = rand ( );
    z(pair) = x ^ y;
  end
%
%  Graphics.
%
  clf ( );
  hist ( z, 100 );
  xlabel ( 'z' );
  ylabel ( 'bin population' );
  label = sprintf ( 'Histogram of X^Y (%d values)', trial_num );
  title ( label );
  filename = 'xyhisto.png';
  print ( '-dpng', filename );
  fprintf ( '  Graphics saved as "%s"\n', filename );

  return
end
