function uniform_on_hypersphere_test ( )

%*****************************************************************************80
%
%% uniform_on_hypersphere_test() tests uniform_on_hypersphere().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 April 2022
%
%  Author:
%
%    John Burkardt
%
  n = 2000;
  d = 3;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'uniform_on_hypersphere_test():\n' );
  fprintf ( 1, '  uniform_on_hypersphere() returns uniform random points\n' );
  fprintf ( 1, '  on the surface of the unit hypersphere.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of points N =    %12d\n', n );
  fprintf ( 1, '  Spatial dimension D =   %12d\n', d );

  p = uniform_on_hypersphere ( n, d );
%
%  Make a plot.
%
  clf ( );
  scatter3 ( p(:,1), p(:,2), p(:,3), 'b', 'filled' );
  grid ( 'on' );
  axis ( 'equal' );
  xlabel ( '<--- X --->' );
  ylabel ( '<--- Y --->' );
  zlabel ( '<--- Z --->' );
  title ( 'uniform\_on\_hypersphere() (3D)' );
  filename = 'uniform_on_hypersphere.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s".\n', filename );

  return
end
