BIS fnc selectRandom: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *O([a-z ])" to "$1 - o$2")
 
(48 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma2
____________________________________________________________________________________________
|version1= 1.00


| arma2 |= Game name
|game2= arma2oa
|version2= 1.50


|1.00|= Game version
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| <pre>/************************************************************
|game4= arma3
Random Select
|version4= 0.50


Parameters: array
|gr1= Arrays


This returns a randomly selected element from the passed array.
|eff= local


Example: [1,2,3] call BIS_fnc_selectRandom
|descr= Selects one of the arguments at random.
Returns: 1, 2, or 3
{{Feature|arma3|Use [[selectRandom]] instead.}}
************************************************************/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|s1= values call [[BIS_fnc_selectRandom]]
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_selectRandom]]; --> |= Syntax
|p1= values: [[Array]] - array of values of which one will be selected at random


|p1= |= Parameter 1
|r1= [[Anything]] - one of the values you passed, chosen at random<br><br>


| |= Return value
|x1= <sqf>private _bestShooter = [_rento, _ben, _trit] call BIS_fnc_selectRandom; // returns one of the variables
____________________________________________________________________________________________
_bestSeries = [["halo1","halo2"],["ofp","arma2"]] call BIS_fnc_selectRandom; // returns one of the arrays
 
</sqf>
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[selectRandom]]
}}
}}
<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:selectRandom}}]]
[[Category:Functions|{{uc:selectRandom}}]]
[[Category:{{Name|arma2}}: Functions|{{uc:selectRandom}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:selectRandom}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:selectRandom}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:selectRandom}}]]

Latest revision as of 15:44, 8 November 2023

Hover & click on the images for description

Description

Description:
Selects one of the arguments at random.
Arma 3
Use selectRandom instead.
Execution:
call
Groups:
Arrays

Syntax

Syntax:
values call BIS_fnc_selectRandom
Parameters:
values: Array - array of values of which one will be selected at random
Return Value:
Anything - one of the values you passed, chosen at random

Examples

Example 1:
private _bestShooter = [_rento, _ben, _trit] call BIS_fnc_selectRandom; // returns one of the variables _bestSeries = [["halo1","halo2"],["ofp","arma2"]] call BIS_fnc_selectRandom; // returns one of the arrays

Additional Information

See also:
selectRandom

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