BIS fnc selectRandomWeighted: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " +" to " ")
m (Text replacement - " \| *([^=\| ]+) * \|p1=" to " |s1= $1 |p1=")
Line 21: Line 21:
{{Feature|arma3|See [[selectRandomWeighted]] for an engine solution.}}
{{Feature|arma3|See [[selectRandomWeighted]] for an engine solution.}}


| itemsAndWeights call [[BIS_fnc_selectRandomWeighted]]
|s1=  itemsAndWeights call [[BIS_fnc_selectRandomWeighted]]


|p1=itemsAndWeights: [[Array]] - array of items and weights [item, weight, item, weight...]
|p1=itemsAndWeights: [[Array]] - array of items and weights [item, weight, item, weight...]

Revision as of 23:44, 12 June 2021

Hover & click on the images for description

Description

Description:
Description needed
Execution:
call
Groups:
Arrays

Syntax

Syntax:
itemsAndWeights call BIS_fnc_selectRandomWeighted
Parameters:
itemsAndWeights: Array - array of items and weights [item, weight, item, weight...]
Return Value:
Anything

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:
selectRandomWeighted

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