MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / random_next

Function random_next

TheForceEngine/TFE_DarkForces/random.cpp:26–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 }
25
26 s32 random_next()
27 {
28 // Shift the seed by 1 (divide by two), and
29 // xor the top 8 bits with b10100011 (163) if the starting seed is odd.
30 // This has the effect of increasing the size of the seed if it gets too small due to the shifts, and increasing "randomness"
31 if (s_seed & 1)
32 {
33 s_seed = (s_seed >> 1) ^ 0xa3000000;
34 }
35 else
36 {
37 s_seed = (s_seed >> 1);
38 }
39 return s32(s_seed);
40 }
41
42 // Generate a random value as:
43 // 1) random_next() or

Callers 6

randomFunction · 0.85
generatorTaskFuncFunction · 0.85
logic_spawnEnemyFunction · 0.85
bobaFett_handleSearchFunction · 0.85
flyingModuleFunc_RemoteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected