MCPcopy Create free account
hub / github.com/diasurgical/devilution / random_

Function random_

Source/engine.cpp:927–934  ·  view source on GitHub ↗

* @brief Main RNG function * @param idx Unused * @param v The upper limit for the return value * @return A random number from 0 to (v-1) */

Source from the content-addressed store, hash-verified

925 * @return A random number from 0 to (v-1)
926 */
927int random_(BYTE idx, int v)
928{
929 if (v <= 0)
930 return 0;
931 if (v < 0xFFFF)
932 return (GetRndSeed() >> 16) % v;
933 return GetRndSeed() % v;
934}
935
936/**
937 * @brief Multithreaded safe malloc

Callers 15

town.cppFile · 0.85
DRLG_PlaceMiniSetFunction · 0.85
DRLG_L1FloorFunction · 0.85
L5roomGenFunction · 0.85
L5firstRoomFunction · 0.85
L5HorizWallFunction · 0.85
L5VertWallFunction · 0.85
L5AddWallFunction · 0.85
DRLG_L5SubsFunction · 0.85
L5FillChambersFunction · 0.85
InitRndLocObjFunction · 0.85
InitRndLocBigObjFunction · 0.85

Calls 1

GetRndSeedFunction · 0.85

Tested by

no test coverage detected