Implements a parallel version of Kmeans

Former-commit-id: 58ab24b9b274451e00eea0275249234e2c2ea09b
This commit is contained in:
2023-08-26 01:26:40 +02:00
parent 077f3b5bb5
commit cbd42d5b30
3 changed files with 182 additions and 72 deletions

View File

@ -2,7 +2,17 @@ package obistats
import "math/rand"
func SampleIntWithoutReplacemant(n, max int) []int {
// SampleIntWithoutReplacement generates a random sample of unique integers without replacement.
//
// Generates a random sample of n unique integers without replacement included in the range [0, max).
//
// Parameters:
// - n: the number of integers to generate.
// - max: the maximum value for the generated integers.
//
// Returns:
// - []int: a slice of integers containing the generated sample.
func SampleIntWithoutReplacement(n, max int) []int {
draw := make(map[int]int, n)