BIS fnc selectRandom: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>")
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *O([a-z ])" to "$1 - o$2")
 
(6 intermediate revisions by the same user not shown)
Line 24: Line 24:
|p1= values: [[Array]] - array of values of which one will be selected at random
|p1= values: [[Array]] - array of values of which one will be selected at random


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


|x1= <code>private _bestShooter = [_rento, _ben, _trit] [[call]] [[BIS_fnc_selectRandom]]; {{cc|returns one of the variables}}
|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]]; {{cc|returns one of the arrays}}
_bestSeries = [["halo1","halo2"],["ofp","arma2"]] call BIS_fnc_selectRandom; // returns one of the arrays
</code>
</sqf>


|seealso= [[selectRandom]]
|seealso= [[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