A script that recreates the engine's math.random stream by replicating the seeding logic and brute-forcing the internal clock offset.
Note
This does not work on Roblox. It targets standalone Luau builds.
Luau's RNG seed is a mix of a memory address (randomized per process by ASLR), the current time, and a clock offset. The script exploits the predictable nature of these components to reconstruct the seed.
This project:
- Derives the base address using
tostring(assert)as an anchor. - Combines it with
os.time()to reconstruct the known parts of the seed. - Brute-forces the remaining clock value until the output matches a known
math.randomresult. - Predicts future outputs using a pure Luau implementation of PCG32.
ANCHOR_TO_L_OFFSET: This offset may be specific to the Luau version/build. If the script fails, this offset is likely incorrect for your binary.- Brute-force range: Currently set to
1000-4000. If a seed isn't found, try widening this range. - Target: This implementation specifically targets the
math.random(n)(one argument) code path.
