BIS fnc selectRandom: Difference between revisions

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


| arma2 |=
|game1= arma2
|1.00|=
|version1= 1.00


|game2= TKOH |=
|game2= arma2oa
|version2= 1.00|=
|version2= 1.50


|arg= |= MPARGUMENTS
|game3= tkoh
|eff= local |= Effects in MP
|version3= 1.00
____________________________________________________________________________________________


| Selects one of the arguments at random
|game4= arma3
|=
|version4= 0.50
____________________________________________________________________________________________


| var1 call '''BIS_fnc_selectRandom'''  |=
|gr1= Arrays


|p1= var1: [[Array]] - array of values of which one will be selected at random |= PARAMETER1
|eff= local


| [[Any Value]] - One of the values you passed, chosen at random<br /><br /> |= RETURNVALUE
|descr= Selects one of the arguments at random.
{{Feature|arma3|Use [[selectRandom]] instead.}}


|x1= <code>_bestShooter <nowiki>=</nowiki> [_rento, _ben, _trit] [[call]] BIS_fnc_selectRandom;</code>|= EXAMPLE1
|s1= values call [[BIS_fnc_selectRandom]]
____________________________________________________________________________________________


| |= SEEALSO
|p1= values: [[Array]] - array of values of which one will be selected at random


| |= MPBEHAVIOUR
|r1= [[Anything]] - one of the values you passed, chosen at random<br><br>
____________________________________________________________________________________________
}}


<h3 style="display:none">Notes</h3>
|x1= <sqf>private _bestShooter = [_rento, _ben, _trit] call BIS_fnc_selectRandom; // returns one of the variables
<dl class="command_description">
_bestSeries = [["halo1","halo2"],["ofp","arma2"]] call BIS_fnc_selectRandom; // returns one of the arrays
<!-- Note Section BEGIN -->
</sqf>


<!-- Note Section END -->
|seealso= [[selectRandom]]
</dl>
}}
 
<h3 style="display:none">Bottom Section</h3>
 
[[Category:ArmA_2:_Functions|SELECTRANDOM]]
[[Category:Take_On_Helicopters:_Functions|selectRandom]]
[[Category:Function Group: Misc|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