MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / percent

Function percent

src/Engine/RNG.cpp:133–136  ·  view source on GitHub ↗

* Generates a random percent chance of an event occuring, * and returns the result * @param value Value percentage (0-100%) * @return True if the chance succeeded. */

Source from the content-addressed store, hash-verified

131 * @return True if the chance succeeded.
132 */
133bool percent(int value)
134{
135 return (generate(0, 99) < value);
136}
137
138/**
139 * Generates a random positive integer up to a number.

Callers 15

detectMethod · 0.85
igniteMethod · 0.85
prepareNewTurnMethod · 0.85
addAlienMethod · 0.85
explodePowerSourcesMethod · 0.85
thinkMethod · 0.85
psiActionMethod · 0.85
explodeMethod · 0.85
thinkMethod · 0.85
initSaveMethod · 0.85
nextStepMethod · 0.85
operator()Method · 0.85

Calls 1

generateFunction · 0.85

Tested by

no test coverage detected