function r8vec_bin_test ( )

%*****************************************************************************80
%
%% R8VEC_BIN_TEST tests R8VEC_BIN.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    05 August 2018
%
%  Author:
%
%    John Burkardt
%
  n = 100;

  a = 8.0;
  b = 25.0;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8VEC_BIN_TEST\n' );
  fprintf ( 1, '  R8VEC_BIN sorts an R8VEC into bins.\n' );

  seed = 123456789;

  [ r, seed ] = r8vec_uniform_ab ( n, a, b, seed );

  r8vec_print_some ( n, r, 10, '  Some of the R8VEC:' );

  bin_num = 10;
  bin_min = 10.0;
  bin_max = 20.0;
  [ bin, bin_limit ] = r8vec_bin ( n, r, bin_num, bin_min, bin_max );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Bin  Population  Limits\n' );
  fprintf ( 1, '\n' );
  for i = 1 : bin_num + 2
    if ( i == 1 )
      fprintf ( 1, '  %2d  %4d  -Inf < x < %g\n', i, bin(i), bin_limit(i) );
    elseif ( i < bin_num + 2 )
      fprintf ( 1, '  %2d  %4d  %g < x < %g\n', i, bin(i), bin_limit(i-1), bin_limit(i) );
    else
      fprintf ( 1, '  %2d  %4d  %g < x < +Inf\n', i, bin(i), bin_limit(i-1) );
    end
  end
 
  return
end
