CBA_fnc_shuffle

Description

Shuffles an array’s contents into random order, returning a new array.

Parameters

_arrayArray of values to shuffle [Array, containing anything except nil]

Returns

New array containing shuffled values from original array [Array]

Example

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

TODO

Allow shuffling of elements in-place, using the original array.

Author

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

Close