ProbabilityCalculator
Appearance
| Environment: | Mission Scripting | |
|---|---|---|
| Function: | ProbabilityCalculator | |
| Function Description: | Calculates the probability of two numbers out of a total sum, returning either a single probability or a table of two probabilities based on a boolean flag. | |
| File Location: | cmm.mathsFunctions.lua | |
| Syntax: | CMM.ProbabilityCalculator( number num1 , number num2 , boolean GiveBothBool ) | |
| Return Value: | any | |
| Parameters: | Name | Description |
| num1 | First number used in the probability calculation, representing one part of the total. | |
| num2 | Second number used in the probability calculation, representing the other part of the total. | |
| GiveBothBool | If true, returns a table with both probabilities; if false or omitted, returns only the first probability (defaults to false). | |
| Example: | CMM.ProbabilityCalculator(10, 20, true) | |
| Example Description: | Returns a table {0.333, 0.667} representing the probabilities of 10 and 20 out of a total of 30. | |
| Related Functions: | ||
| Notes: | ||