You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
222 B
Go
15 lines
222 B
Go
3 years ago
|
package internal
|
||
4 years ago
|
|
||
|
import "math/rand"
|
||
|
|
||
|
func subset(set []string, sub int) []string {
|
||
|
rand.Shuffle(len(set), func(i, j int) {
|
||
|
set[i], set[j] = set[j], set[i]
|
||
|
})
|
||
|
if len(set) <= sub {
|
||
|
return set
|
||
|
}
|
||
4 years ago
|
|
||
|
return set[:sub]
|
||
4 years ago
|
}
|