Pick random element: Difference between revisions
Content deleted Content added
Add Seed7 example |
Go solution |
||
Line 29: | Line 29: | ||
<lang euphoria>constant s = {'a', 'b', 'c'} |
<lang euphoria>constant s = {'a', 'b', 'c'} |
||
puts(1,s[rand($)])</lang> |
puts(1,s[rand($)])</lang> |
||
=={{header|Go}}== |
|||
<lang go>package main |
|||
import ( |
|||
"fmt" |
|||
"rand" |
|||
"time" |
|||
) |
|||
var list = []string{"bleen", "fuligin", "garrow", "grue", "hooloovoo"} |
|||
func main() { |
|||
rand.Seed(time.Nanoseconds()) |
|||
fmt.Println(list[rand.Intn(len(list))]) |
|||
}</lang> |
|||
=={{header|Haskell}}== |
=={{header|Haskell}}== |