mirror of
https://github.com/maaslalani/confetty.git
synced 2024-11-22 23:56:47 +00:00
10 lines
178 B
Go
10 lines
178 B
Go
|
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))]
|
||
|
}
|