uint64, data []*entityIdeaVector.Entity) ([][]float64, error) { seeds := make([][]float64, numCluster) e := data[rand.Intn(len(data))] seeds[0] = e.Vector for i := uint64(1); i < numCluster; i++ { dist := make([]float64, len(data)) var sum float64 for k, v := range data { _, dist[k] = nearest(seeds, v.Vector) sum += dist[k] } threshold := rand.Float64() * sum var stack float64 var dataNum int for k, v := range dist { stack += v if threshold < stack { dataNum = k break } } seeds[i] = data[dataNum].Vector } return seeds, nil }