Pick random element: Difference between revisions

Content deleted Content added
Wutang (talk | contribs)
Wutang (talk | contribs)
Line 1,606: Line 1,606:
fn main() {
fn main() {
list := ["friends", "peace", "people", "happiness", "hello", "world"]
list := ["friends", "peace", "people", "happiness", "hello", "world"]
for index in 1..list.len + 1 {println(index.str() + ': ' + list[rand.intn(list.len) ?])}
for index in 1..list.len + 1 {println(index.str() + ': ' + list[rand.intn(list.len) or {}])}
}</lang>
}</lang>