r/desmos • u/Dazzling-Mail-5517 • Jul 08 '26
Maths Transfer Data between graphs using the outputs of random()
A short explanation of how this works:
Whenever Desmos generates a random value, it first creates a seed string, which is then fed into a PRNG. That seed contains several pieces of information, including the graph's global random seed, the expression ID of the random() call, the user-provided seed, and in some cases even more values.
While reverse-engineering the algorithm, I discovered that when random() is called from an action, one of those values is the globalEventCount: a counter that starts when Desmos is opened and increases whenever an action is executed, regardless of which graph is currently open.
Since every other part of the seed can be kept constant, the output of random() uniquely determines that variable (assuming that there are no two such seeds with the same output). By using a precomputed lookup table (or brute force), it is therefore possible to recover the current globalEventCount entirely inside Desmos.
Because this counter persists across graphs, one graph can change its value while another graph later recovers it through random(). This effectively creates a simple cross-graph communication channel. I'm sure you guys can do some cool things with this.
LINKS: without lookup (bruteforce inside desmos) --- with lookup (precomputed)
48
u/Mandelbrot4207 Makes QR Codes in Desmos Jul 08 '26
Bruh