function cluster_center = cluster_initialize_2 ( dim_num, point_num, ...
  cluster_num, point )

%*****************************************************************************80
%
%% cluster_initialize_2() initializes the cluster centers to random values.
%
%  Discussion:
%
%    In this case, the hyperbox containing the data is computed.
%
%    Then the cluster centers are chosen uniformly at random within
%    this hyperbox.
%
%    Of course, if the data is not smoothly distributed throughout
%    the box, many cluster centers will be isolated.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    04 October 2009
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer DIM_NUM, the number of spatial dimensions.
%
%    integer POINT_NUM, the number of points.
%
%    integer CLUSTER_NUM, the number of clusters.
%
%    real POINT(POINT_NUM,DIM_NUM), the coordinates of the points.
%
%  Output:
%
%    real CLUSTER_CENTER(CLUSTER_NUM,DIM_NUM), 
%    the coordinates of the cluster centers.
%
  r_min(1) = min ( point(1:point_num,1);
  r_min(2) = min ( point(1:point_num,2);
  r_max(1) = max ( point(1:point_num,1);
  r_max(2) = max ( point(1:point_num,2);

  for i = 1 : cluster_num

    r = rand ( 1, dim_num );

    cluster_center(i,1:dim_num) = ...
      ( 1.0 - r(1:dim_num) ) * r_min(1:dim_num) ...
            + r(1:dim_num)   * r_max(1:dim_num);
  end
    
  return
end
