CBA_fnc_shuffle

Description

Shuffles an array’s contents into random order.

Parameters

_arrayArray of values to shuffle <Array, containing anything except nil>
_inPlacetrue: alter array, false: copy array (optional, default: false) <BOOLEAN>

Returns

Array containing shuffled values <Array>

Example

_result = [[1, 2, 3, 4, 5]] call CBA_fnc_shuffle;
// _result could be [4, 2, 5, 1, 3]
_array = [1, 2, 3, 4, 5];
[_array, true] call CBA_fnc_shuffle;
// _array could now be [4, 2, 5, 1, 3]

Author

toadlife (version 1.01) http://toadlife.net rewritten by Spooner, Dorbedo

Close