code for random init of centroids