Regarding function in constraints

In reply to dave_59:

Thanks Dave .

A function body that refers to variables outside the definition of the function body is a side-effect. The behavior is not defined.

On trying the code with a slight modification in the constraint : edaplayground

Two tools return the default value ( on 1st call to randomize() ) or the sum of the previous randomized values of y and z ( during latter calls )

3rd tool throws a compilation error since we access variables outside the function( which is along LRM )

So ideally a function called in constraint should have input arguments and the body of the function should only access the input arguments.
For functions with no input arguments , tools have different implementations. Hence such functions should be avoided.