From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Software:Doom" |
|---|
| claim | "P_Random (gameplay) and M_Random (menus, effects) each pre-increment their own index modulo 256 and return rndtable[index]; both indices are reset to 0 by M_ClearRandom in G_InitNew, so the first value returned at level start is 8." |
|---|
| scope | | level | "software" |
|---|
| applies_to | "Software:Doom" |
|---|
| observed_in | |
|---|
|
|---|
| data | | function | "P_Random / M_Random" |
|---|
| effect | "index = (index + 1) & 0xFF; return rndtable[index]" |
|---|
| trigger | "G_InitNew calls M_ClearRandom (rndindex = prndindex = 0)" |
|---|
|
|---|
| evidence | | type | "documentation" |
|---|
| detail | "linuxdoom-1.10/m_random.c; g_game.c G_InitNew calls M_ClearRandom." |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "P_Random and M_Random" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T03:43:17.140Z" |
|---|
| verifications | |
|---|