> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/p/pick_random_element.md).

# Pick random element

```ruby
var arr = %w(north east south west)
say arr.rand
say arr.rand(2)
```

#### Output:

```
south
['west', 'south']
```
