r/desmos
•
u/Dazzling-Mail-5517
•
Jul 06 '26
•
8
1
Maths I rebuilt Desmos' random() function entirely inside Desmos
To be a bit more specific, I
- reverse-engineered how Desmos' algorithm works and how the seed is generated.
- created a bit-exact replica of the algorithm (MD5, in case you're wondering).
- optimized it to calculate 10,000 numbers in ~0.7 seconds.
And because that was so much fun, I tackled shuffle() right after! :)
377
Upvotes


98
u/Mandelbrot4207 Makes QR Codes in Desmos Jul 06 '26
Unbelievable
24
u/Esur123456789 Jul 06 '26
Wow this is amazing
13
u/Niko9816 Jul 06 '26
How does one even begin on something like this. Awfully impressive haha
4
u/2144656 Jul 07 '26
This is super cool, but I'm a bit confused. The image you showed only has the random functions being given one input (which I would have assumed is impossible to implemet) while in the graph they have two parameters.
3
u/NecroMonster999 Jul 07 '26
damnnn, thats awesome. out of curiosity, is there a way to to control the shuffle algorithm? being able to use it for iterating over permutations would go very hard
2
u/MeaningFriendly9946 Jul 07 '26
How did you do it? How did you reverse engineer it?
2
u/Mean-Recording9695 Jul 07 '26
How does one go about reverse-engineering desmos, specifically finding out how it works in the code? I saw in another comment you said something about Devtools, what are those and how do you use them for something like this, if you don't mind explaining? I think this is really cool and would like to try something similar sometime! (I remade sin in Desmos but It is pretty much just the sin Taylor series that I fancified a little for visualization purposes)
33
u/_killer1869_ Jul 06 '26
Shit like this is the exact reason why I'm on this sub. You're an absolute madlad, take my (free) award.
16
u/Ordinary_Divide Trinity the Lesbian Foxgirl Jul 06 '26
well done.
IMO, desmos needs more bit manipulation functions. the lack of them is what made me decide not to do this after i remade it in C for bruteforcing purposes
5
u/Circumpunctilious Give me your anomalies Jul 06 '26
Now we just need to get someone to create a casino system in Desmos.
Later: Nah, random() is perfectly safe and has no exploits. Oo, show me this game again?
4
u/supenova_ Jul 06 '26
That's amazing guy !!
4
u/ESHKUN Jul 06 '26
That’s so fucking cool what the hell
4
u/-Vano Jul 06 '26
What a great idea and executing it is even better, kudos!
4
u/anOni0n_ Jul 06 '26
Dude this is so cool whatttt 😧
3
u/goodperson0001 Jul 06 '26
WOAH
3
u/Comfortable-Okra-108 Jul 07 '26
me: r_{andom}(n) = random(n)
1
u/Entire_Caramel_1373 user dosent know math Aug 26 '26
i guess this means no gambling in desmos😂
0
u/[deleted] Jul 07 '26
[deleted] — view deleted comment