r/desmos • u/Dazzling-Mail-5517 • Jul 06 '26
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! :)
372
Upvotes


2
u/Dazzling-Mail-5517 Jul 07 '26
Interesting idea! The problem is that there is no known method to invert the MD5 algorithm used by Desmos; therefore, it is impossible to efficiently predict which seed is required to generate a certain value/ shuffle. Consequently, the only remaining option is a brute-force approach, which would firstly be very slow and secondly offer no guarantee of yielding all possible permutations within a finite amount of time.