function r = user_circle_2d ( m, n )

%*****************************************************************************80
%
%% user_circle_2d() samples points in a user-specified region with given density.
%
%  Discussion:
%
%    This routine can be used to 
%
%    * specify an interesting initial configuration for the data,
%      by specifing that USER be used for initialization (INIT = 3);
%
%    * specify the shape of the computational region, by specifying
%      that sample points are to be generated by this routine, 
%      (SAMPLE = 3) and then returning sample points uniformly at random.
%
%    * specify the distribution or density function, by specifying
%      that sample points are to be generated by this routine, 
%      (SAMPLE = 3 ) and then returning sample points according to a 
%      given probability density function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 June 2005
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer DIM_NUM, the spatial dimension.
%
%    integer N, the number of sample points desired.
%
%  Output:
%
%    real R(DIM_NUM,N), a set of N sample values.
%
  
%
%  We sample points in the unit circle uniformly.
%
  angle(1:n) = 2.0 * pi * rand(1,n);
  radius(1:n) = sqrt ( rand(1,n) );

  r(1,1:n) = radius(1:n) .* cos ( angle(1:n) );
  r(2,1:n) = radius(1:n) .* sin ( angle(1:n) );

  return
end
