BIS fnc selectRandomWeighted: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Function " to "{{RV|type=function ")
m (Text replacement - " *\| *PARAMETER[0-9]{1,3} *= * " to " ")
Line 21: Line 21:
|s2= [items, weights] call [[BIS_fnc_selectRandomWeighted]]
|s2= [items, weights] call [[BIS_fnc_selectRandomWeighted]]


|p21=[items, weights]: [[Array]]|PARAMETER21=
|p21=[items, weights]: [[Array]]
|p22=items: [[Array]] - items array of [[Anything]] |PARAMETER22=
|p22=items: [[Array]] - items array of [[Anything]]


|p23=weights: [[Array]] - weights array of [[Number]]s |PARAMETER23=
|p23=weights: [[Array]] - weights array of [[Number]]s


|r2= [[Anything]]
|r2= [[Anything]]

Revision as of 18:10, 29 January 2021

Hover & click on the images for description

Description

Description:
Description needed
Execution:
call
Groups:
Arrays

Syntax

Syntax:
Syntax needed
Parameters:
itemsAndWeights: Array - array of items and weights [item, weight, item, weight...]
Return Value:
Return value needed

Alternative Syntax

Syntax:
[items, weights] call BIS_fnc_selectRandomWeighted
Parameters:
[items, weights]: Array
items: Array - items array of Anything
weights: Array - weights array of Numbers
Return Value:
Anything

Examples

Example 1:
["apples",.3,"pears",.2,"bananas",.4,"diamonds",.1,"unicorns",.00001] call BIS_fnc_selectRandomWeighted;
Example 2:
[["apples","pears","bananas","diamonds"],[0.3,0.2,0.4,0.1]] call BIS_fnc_selectRandomWeighted;

Additional Information

See also:
See also needed

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