confetty/pkg/array/array.go

10 lines
178 B
Go
Raw Normal View History

2021-08-07 02:08:18 +00:00
package array
import "math/rand"
// Sample returns a random element from an array
// (can't wait for generics!)
func Sample(s []string) string {
return s[rand.Intn(len(s))]
}