function C = inithcm(cluster_n,data)
%INITHCM generates initial cluster centers by randomly selecting c points  
%from among all of the data points.

%Caraon KAO, May 9, 1997
[data_n data_dim] = size(data);
index_center = [ceil(data_n*rand(1))];
i = 1;
while i < cluster_n,
   rand_select = ceil(data_n*rand(1));
   center_equal = 1;
   for j = 1:i, 	%check index_center elements are all different
       if rand_select == index_center(j),
          center_equal = 0;
       end
   end
   if center_equal ==1,	
      index_center = [index_center rand_select];
      i = i + 1;
   end
end
C = [];
for k = 1:data_dim,
   data_column = data(:,k);
   C = [C data_column(index_center)];
end
