Turns out I'd messed up the random number generator. Not crucial for its common purpose (being a source of replicable data), but the 16807 RNG is something of a standard, and my broken implementation made it incompatible with the naive python implementation (because of 32 bit clipping issues).