function [ x, seed ] = disk_sample ( center, r, n, seed )

%*****************************************************************************80
%
%% DISK_SAMPLE uniformly samples a disk.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    04 July 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real CENTER(2), the center of the disk.
%
%    Input, real R, the radius of the disk.
%
%    Input, integer N, the number of points.
%
%    Input/output, integer SEED, a seed for the random 
%    number generator.
%
%    Output, real X(2,N), the points.
%
  x = randn ( 2, n );
  norm = ones ( 1, 2 ) * ( x.^2 );
  norm = sqrt ( norm );
  for i = 1 : 2
    x(i,1:n) = x(i,1:n) ./ norm(1:n);
  end

  center = center(:);
  center_vec = repmat ( center, 1, n );

  [ r2, seed ] = r8vec_uniform_01 ( n, seed );
  r2_vec = repmat ( r2', 2, 1 );

  x = center_vec + r * sqrt ( r2_vec ) .* x;

  return
end
