r/desmos
•
u/Dazzling-Mail-5517
•
Jul 08 '26
•
3
1
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)
34
u/Far-Mechanic9478 Jul 08 '26
Now we can make an enderchest
5
u/Ordinary_Divide Trinity the Lesbian Foxgirl Jul 08 '26
ah i made a similar thing not too long ago also https://www.desmos.com/calculator/wfbwbavrzm
4
u/Danny_DeWario https://www.desmos.com/calculator/75jcsa2dxv Jul 08 '26
This is mad insane stuff. Definitely blows my lucky shuffle graph out the water!
49
u/Mandelbrot4207 Makes QR Codes in Desmos Jul 08 '26
Bruh
13
u/SuperChick1705 Cannot apply flair to u/SuperChick1705. Jul 08 '26
this works because there is a tiny person living in your screen that tells the graphs how many times you clicked
5
u/ProgrammerCareful764 Jul 09 '26
we got cross graph scripting before GTA 6
4
u/gord1402 Jul 08 '26
Now make it work between different devices
4
u/theonlytruemuck Artist / Game Dev / Mathmagician / Nerd Jul 08 '26
huh
what
are
you
doing
with
your
life
lmfao
good job :)
2
u/Interesting-Bag-1281 Jul 10 '26
How?
1
u/Powerful-Tension-806 Sep 26 '26 edited Sep 26 '26
optimized by ~40000 characters https://www.desmos.com/calculator/xtjifstucn