The error arises when the editor tries to decide whether to regenerate the question instance used for testing. It compares the values of all variables against the last ones it used and gives up if they're all the same. Equality isn't defined for anonymous functions, so an error is thrown.
I've changed it to skip over values that don't have a defined equality method. I can only see that causing a problem if you have no random variables but somehow make a change to the value of an anonymous function by other means.