MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Tools_RandomLCG_Range

Function Tools_RandomLCG_Range

src/tools.c:292–308  ·  view source on GitHub ↗

* Get a random value between the given values. * * @param min The minimum value. * @param max The maximum value. * @return The random value. */

Source from the content-addressed store, hash-verified

290 * @return The random value.
291 */
292uint16 Tools_RandomLCG_Range(uint16 min, uint16 max)
293{
294 uint16 ret;
295
296 if (min > max) {
297 uint16 temp = min;
298 min = max;
299 max = temp;
300 }
301
302 do {
303 uint16 value = (int32)Tools_RandomLCG() * (max - min + 1) / 0x8000 + min;
304 ret = value;
305 } while (ret > max);
306
307 return ret;
308}
309
310#ifndef BITARRAY_MACROS
311/**

Callers 15

Map_Bloom_ExplodeSpecialFunction · 0.85
Map_FindLocationTileFunction · 0.85
GameLoop_HouseFunction · 0.85
GameLoop_MainFunction · 0.85
Script_Team_Unknown0788Function · 0.85
Script_Unit_IdleActionFunction · 0.85
GUI_EndStats_ShowFunction · 0.85

Calls 1

Tools_RandomLCGFunction · 0.85

Tested by

no test coverage detected