function [ m, p, id ] = ring_data_generate ( ring_num, ring_pop, ring_rad1, ...
  ring_rad2 )

%*****************************************************************************80
%
%% RING_DATA_GENERATE generates ring data.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    11 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer RING_NUM, the number of rings.
%
%    Input, integer RING_POP(RING_NUM), the number of points to be created
%    in each ring.
%
%    Input, real RING_RAD1(RING_NUM), RING_RAD2(RING_NUM), the inner and
%    outer radius of each ring.
%
%    Output, integer M, the total number of points.
%
%    Output, real P(2,M), the coordinates of the points.
%
%    Output, integer ID(M), the index of the ring to which each point belongs.
%
  pc(1:2) = 0.0;

  m = sum ( ring_pop(1:ring_num) );
  p = zeros ( m, 2 );
  id = zeros ( m, 1 );

  seed = 123456789;

  m2 = 0;

  for i = 1 : ring_num
    m1 = m2 + 1;
    m2 = m1 + ring_pop(i) - 1;
    [ p(m1:m2,1:2), seed ] = annulus_sample ( pc, ring_rad1(i), ...
      ring_rad2(i), ring_pop(i), seed );
    id(m1:m2) = i;
  end
%
%  Permute the data.
%
  j = randperm ( m );
  p = p(j,1:2);
  id = id(j);

  return
end

