function xyhisto ( )

%*****************************************************************************80
%
%% XYHISTO makes a histogram of X^Y.
%
%  Discussion:
%
%    This m-file produces 20,000 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.
%
%  Modified:
%
%    29 January 2018
%
%  Author:
%
%    Paul Nahin
%
%  Reference:
%
%    Paul Nahin,
%    Dueling Idiots and Other Probability Puzzlers,
%    Princeton, 2012,
%    ISBN: 978-0691155005.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'XYHISTO\n' );
  fprintf ( 1, '  This m-file produces 20,000 values of X raised to the Y power,\n' );
  fprintf ( 1, '  where X and Y are both uniform from 0 to 1, and independent. It\n' );
  fprintf ( 1, '  then plots a histogram of the values using 100 bins.\n' );

  for pair = 1 : 20000
    x = rand ( );
    y = rand ( );
    z(pair) = x ^ y;
  end
%
%  Graphics.
%
  clf
  hist ( z, 100 )
  xlabel('z')
  ylabel('number of values per bin')
  title('Fig.13.3 - Histogram of X^Y (20,000 values)')
  print ( '-dpng', 'xyhisto.png' )

  return
end
