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
232 B
Go
15 lines
232 B
Go
4 years ago
|
package resolver
|
||
|
|
||
|
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
|
||
|
} else {
|
||
|
return set[:sub]
|
||
|
}
|
||
|
}
|