BIS_fnc_selectRandomWeighted
Jump to navigation
Jump to search
Description
- Description:
- Selects a random item from an array, taking into account item weight.
- 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: 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:
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