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

Function Tools_Random_256

src/tools.c:239–253  ·  view source on GitHub ↗

* Get a random value between 0 and 255. * * @return The random value. */

Source from the content-addressed store, hash-verified

237 * @return The random value.
238 */
239uint8 Tools_Random_256(void)
240{
241 uint16 val16;
242 uint8 val8;
243
244 val16 = (s_randomSeed[1] << 8) | s_randomSeed[2];
245 val8 = ((val16 ^ 0x8000) >> 15) & 1;
246 val16 = (val16 << 1) | ((s_randomSeed[0] >> 1) & 1);
247 val8 = (s_randomSeed[0] >> 2) - s_randomSeed[0] - val8;
248 s_randomSeed[0] = (val8 << 7) | (s_randomSeed[0] >> 1);
249 s_randomSeed[1] = val16 >> 8;
250 s_randomSeed[2] = val16 & 0xFF;
251
252 return s_randomSeed[0] ^ s_randomSeed[1];
253}
254
255/**
256 * Set the seed for the Tools_Random_256().

Callers 15

Animation_Func_PauseFunction · 0.85
Map_MakeExplosionFunction · 0.85
Map_FillCircleWithSpiceFunction · 0.85
Map_Bloom_ExplodeSpecialFunction · 0.85
Map_CreateLandscapeFunction · 0.85
GameLoop_HouseFunction · 0.85
GameLoop_TeamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected