MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / generateRandomVector

Function generateRandomVector

query/vector/vector_test.go:308–314  ·  view source on GitHub ↗
(size int)

Source from the content-addressed store, hash-verified

306}
307
308func generateRandomVector(size int) []float32 {
309 vector := make([]float32, size)
310 for i := 0; i < size; i++ {
311 vector[i] = rand.Float32() * 10
312 }
313 return vector
314}
315
316func formatVector(label string, vector []float32, index int) string {
317 vectorString := fmt.Sprintf(`"[%s]"`, strings.Trim(strings.Join(strings.Fields(fmt.Sprint(vector)), ", "), "[]"))

Callers 2

updateVectorFunction · 0.85
generateRandomVectorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected