---
name: "selectRandom"
type: command
status: ok
groups: ["Arrays"]
arma3_since: "1.56"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/selectRandom
revid: 377101
updated: 2026-01-01T09:58:32Z
---

# selectRandom

*Command · Arrays · Arma 3 v1.56*

## Description

Returns a random element from the given array. Engine solution to [BIS_fnc_selectRandom](../functions/BIS_fnc_selectRandom.md)

## Syntax

```sqf
selectRandom array
```

**Parameters:**

- `array`: [Array](../topics/Array.md) of [Anything](../topics/Anything.md)

**Returns:** [Anything](../topics/Anything.md) - random selected value or [Nothing](../topics/Nothing.md) if array is empty

## Examples

### Example 1

```sqf
_randomElement = selectRandom [1,2,3,4,5];
```

## See also

[selectRandomWeighted](../commands/selectRandomWeighted.md) · [random](../commands/random.md) · [select](../commands/select.md) · [selectMin](../commands/selectMin.md) · [selectMax](../commands/selectMax.md)

<sub>Source: [BI Community Wiki — selectRandom](https://community.bistudio.com/wiki/selectRandom) (revision 377101).</sub>
