package srv_aicomment import ( "math/rand" ) const ( commentsPerGenerationTask = 8 aiCommentPlayletTotal = 3 ) func selectAIComments(comments []Comment, count int) []Comment { available := make([]Comment, 0, len(comments)) for _, comment := range comments { if comment.Text != "" { available = append(available, comment) } } if count <= 0 || len(available) <= count { return available } rand.Shuffle(len(available), func(i, j int) { available[i], available[j] = available[j], available[i] }) return available[:count] } func randomIntInclusive(minValue, maxValue int) int { if maxValue <= minValue { return minValue } return minValue + rand.Intn(maxValue-minValue+1) }