function w = direction_uniform_nd ( dim_num )

%*****************************************************************************80
%
%% direction_uniform_nd() generates a random direction vector in ND.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 November 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer DIM_NUM, the dimension of the space.
%
%  Output:
%
%    real W(DIM_NUM), a random direction vector,
%    with unit norm.
%

%
%  Get N values from a standard normal distribution.
%
  w = randn ( dim_num, 1 );
%
%  Compute the length of the vector.
%
  w_norm = norm ( w );
%
%  Normalize the vector.
%
  w = w / w_norm;

  return
end
