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

%*****************************************************************************80
%
%% cluster_initialize_4() initializes the cluster centers to random values.
%
%  Discussion:
%
%    In this case, each data point is divided randomly among the
%    the cluster centers.
%
%  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.
%
  cluster_center(1:cluster_num,1:dim_num) = 0.0;
  cluster_weight(1:cluster_num) = 0.0;

  for i = 1 : point_num

    cluster_factor = rand ( cluster_num, 1 );

    divisor = sum ( cluster_factor(1:cluster_num) );
    cluster_factor(1:cluster_num) = cluster_factor(1:cluster_num) / divisor;

    for j = 1 : cluster_num
      cluster_center(j,1:dim_num) = cluster_center(j,1:dim_num) ...
        + cluster_factor(j) * point(i,1:dim_num);
    end

    cluster_weight(1:cluster_num) = cluster_weight(1:cluster_num) ...
      + cluster_factor(1:cluster_num);

  end
%
%  Now normalize,  so that each cluster center is now a convex 
%  combination of the points.
%
  for i = 1 : cluster_num
    cluster_center(i,1:dim_num) = cluster_center(i,1:dim_num) ...
      / cluster_weight(i);
  end

  return
end
