Doom keeps its random numbers in a fixed 256-byte loop
Weapon damage and monster decisions spend entries from the same sequence, making the order of those calls part of the game’s behavior.

Doom can surprise you while consulting the same tiny list again and again. The file m_random.c declares “unsigned char rndtable[256]”, followed by two functions that fetch from it.
P_Random increments prndindex; M_Random increments rndindex. Each masks the new index with 0xff, so it stays in the 0–255 range, then returns the byte at that position. M_ClearRandom sets both indexes back to zero.
Resetting does not make the first returned number zero. Both functions advance before reading, so the first call after a reset returns the second table entry, 8. The next calls return 109 and 220. The zero at the beginning waits until the index wraps. That’s the sort of off-by-one detail that matters if you’re trying to reproduce behavior from a list someone pasted into a forum.
The header file explains the split more directly than the implementation does. Its comment reserves P_Random for “the play simulation,” while the reset function carries the instruction “Fix randoms for demos.” Two callers can consult identical lists without advancing each other’s position. Imagine two people reading their own copy of the same numbered recipe: one person turning a page doesn’t move the other person’s bookmark.
The weapon routines show how a byte becomes something you feel. A punch takes P_Random modulo 10, adds one and doubles it. That produces base damage in even steps from 2 through 20; the strength power-up multiplies it by ten. The attack then uses two further random draws to adjust its angle. One punch can therefore consume multiple entries before another part of the simulation gets a turn.
Monster decisions consult the sequence too. In P_CheckMissileRange, the code first considers visibility, reaction time, distance and monster-specific rules. Near the end it compares P_Random with the adjusted distance to decide whether to attack. The same byte can mean something different depending on who asks for it and what that caller already knows.
That makes a fixed table a surprisingly poor shortcut for predicting an entire encounter. Knowing the next number doesn’t tell you which monster or weapon routine will receive it. The simulation decides when to ask. Add a call while modifying a weapon and later decisions can receive different entries, even though nobody changed the table itself.
A port that wants old demos to behave the same way has a reason to preserve these apparently fussy details. Replacing the list with a newer generator could change the damage or decision reached by a particular call. The source gives a concrete place to investigate a mismatch: the first point where two runs spend different numbers or spend them in a different order.
Finding the first different draw still takes a trace from the particular run that went wrong. A punch and a monster’s decision are two places to start looking; the table alone cannot tell you which got there first.