BIS fnc arrayShuffle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
 
(26 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 0.58


| arma3 |= Game name
|gr1= Arrays


|0.58|= Game version
|descr= Return a new array with randomized order of elements from input array.
____________________________________________________________________________________________


| <pre>/*
|s1= array call [[BIS_fnc_arrayShuffle]]
Description:
This returns a new array with randomized order of elements from input array
Parameters:
_this: ARRAY
Returns:
ARRAY
Example:
[1, 2, 3] call BIS_fnc_arrayShuffle
Returns: [2, 3, 1] (For example)
*/


//The container
|p1= array: [[Array]]
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_arrayShuffle]]; --> |= Syntax
|r1= [[Array]] - a new array instance


|p1= |= Parameter 1
|x1= <sqf>[1,2,3] call BIS_fnc_arrayShuffle; // can return [1,2,3] (the original order), [3,1,2], [2,3,1], [1,3,2], [2,1,3] or [3,2,1]</sqf>
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[sort]] [[BIS_fnc_sortBy]] [[random]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Arrays|{{uc:arrayShuffle}}]]
[[Category:Functions|{{uc:arrayShuffle}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:arrayShuffle}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on November 8, 2016 - 12:51 (UTC)</dd>
<dt class="note">[[User:Zectbumo|Zectbumo]]</dt>
<dd class="note">
The array that is passed in is modified by this operation even though the documentation says "returns a new array".
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 23:13, 12 July 2022

Hover & click on the images for description

Description

Description:
Return a new array with randomized order of elements from input array.
Execution:
call
Groups:
Arrays

Syntax

Syntax:
array call BIS_fnc_arrayShuffle
Parameters:
array: Array
Return Value:
Array - a new array instance

Examples

Example 1:
[1,2,3] call BIS_fnc_arrayShuffle; // can return [1,2,3] (the original order), [3,1,2], [2,3,1], [1,3,2], [2,1,3] or [3,2,1]

Additional Information

See also:
sort BIS_fnc_sortBy random

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note