function generator ( )

%*****************************************************************************80
%
%% GENERATOR plots a histogram of 100,000 random values.
%
%  Discussion:
%
%    A histogram of 100,000 random values will show whether they are
%    uniformly distributed or not.
%
%  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, 'GENERATOR\n' );
  fprintf ( 1, '  A histogram of 100,000 random values will show whether they are\n' );
  fprintf ( 1, '  uniformly distributed or not.\n' );
  
  y = rand ( 100000, 1 );
%
%  Graphics.
%
  clf
  hist ( y, 100 )
  title('Histogram of MATLAB 5.2 Uniform Random Number Generator')
  xlabel('100 bins, 100,000 numbers')
  ylabel('number of numbers in each bin')
  print ( '-dpng', 'generator.png' );

  return
end

