function x = uniform_nsphere_sample ( n )

%*****************************************************************************80
%
%% uniform_nsphere_sample() samples the Uniform Unit Sphere PDF.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 April 2022
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Jerry Banks, editor,
%    Handbook of Simulation,
%    Engineering and Management Press Books, 1998, page 168.
%
%  Input:
%
%    integer N, the dimension of the sphere.
%
%  Output:
%
%    real X(N), a point on the unit N sphere, chosen
%    with a uniform probability.
%
  x = randn ( n );

  x(1:n) = x(1:n) / sqrt ( sum ( x(1:n).^2 ) );

  return
end
