Change to Random Seeds in Function Definitions

The value produced by each use of the Desmos random( ) function is determined by a random seed. The seed automatically incorporates information about the context of each use of the random( ) function - such as which expression it is used in and the location in the expression relative to other usages of random( ). The shuffle( ) function uses a seed in a similar way.

As of March 2024, when random( ) or shuffle( ) is used in a function definition, the value of all of the function’s parameters will be automatically included in the seed. As a consequence, each time the function is applied to arguments with different values, the random( ) or shuffle( ) function will produce a different value.

For example, a function like \(f(x)=random()\) previously produced the same value no matter what arguments it was applied to, so that e.g. \(f(1)\) and \(f(2)\) would always be equal. With the new behavior, random seeds in this function definition will automatically depend on the value of \(x\) so that \(f(1)\) and \(f(2)\) evaluate to different values. Two different uses of \(f(1)\) will continue to evaluate to the same value.

The goal of this change is to better match the intuition that different uses of the random( ) function should produce different values, but other functions should evaluate to the same value when applied to the same arguments.

Graphs created before March 2024 that used random( ) or shuffle( ) in function definitions will preserve the previous behavior but will offer the option to switch to the new behavior.

Error message reading: 'This graph uses legacy randomizations behavior. With an option to 'Update to new behavior'. Screenshot.