function x = ball_unit_sample ( )

%*****************************************************************************80
%
%% BALL_UNIT_SAMPLE returns sample points in the unit ball.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    27 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Russell Cheng,
%    Random Variate Generation,
%    in Handbook of Simulation,
%    edited by Jerry Banks,
%    Wiley, 1998, pages 168.
%
%    Reuven Rubinstein,
%    Monte Carlo Optimization, Simulation, and Sensitivity
%    of Queueing Networks,
%    Wiley, 1986, page 232.
%
%  Parameters:
%
%    Output, real X(3), the point.
%
  x = randn ( 3, 1 );
%
%  Normalize the vector.
%
  x = x / norm ( x );
%
%  Now compute a value to map the point ON the sphere INTO the sphere.
%
  r = rand ( );
 
  x = r ^ ( 1.0 / 3.0 ) * x;

  return
end
